Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to safely stop the images #989

Closed
restlessdesign opened this issue Dec 27, 2016 · 4 comments
Closed

How to safely stop the images #989

restlessdesign opened this issue Dec 27, 2016 · 4 comments
Labels
area/compose Relates to docker-compose.yml spec or docker-compose binary lifecycle/locked

Comments

@restlessdesign
Copy link

File: compose/rails.md

Note: If you stop the example application and attempt to restart it, you might get the following error: web_1 | A server is already running. Check /myapp/tmp/pids/server.pid. One way to resolve this is to delete the file tmp/pids/server.pid, and then re-start the application with docker-compose up.

Unless Ctrl-C is not the preferred way to terminate the process, this issue happens 100% of the time (for me*). Per docker/compose#1393, the workaround is to change the command to the following:

command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"

Would there be any opposition if I were to create a PR which amended this tutorial? If not, would the preference be to A.) update the command line directly and remove the note or B.) amend the note to suggest this alternative?


* — System/environment specs are as follows (macOS):

Version 1.12.5 (14777)
Channel: Stable
3e6f00c1dc
@mdlinville mdlinville changed the title Feedback for: compose/rails.md How to safely stop the images Apr 4, 2017
@mdlinville mdlinville added area/compose Relates to docker-compose.yml spec or docker-compose binary area/tutorials labels Apr 4, 2017
@mdlinville
Copy link

See the response on #3730 about why we are going to leave this as it is. Thanks!

@cowgill
Copy link

cowgill commented Jan 13, 2018

If you're using Alpine Linux (with no bash), you'd want to use this command instead:

command: /bin/sh -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"

@benthorner
Copy link

I came across this problem myself. Another approach, if you don't re-use your containers (e.g. if you use the '--rm' flag) is to specify -P /tmp/rails.pid in the startup command. This means you can run the same Rails app in multiple containers, and the pidfile gets automatically deleted with the container.

rails/rails#36486

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

@docker docker locked and limited conversation to collaborators Mar 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/compose Relates to docker-compose.yml spec or docker-compose binary lifecycle/locked
Projects
None yet
Development

No branches or pull requests

5 participants