Last active
August 29, 2015 14:16
-
-
Save chiedo/e3ff751fed1b641c2ee9 to your computer and use it in GitHub Desktop.
Have your docker container start wait for your to enter it with the command it provides.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested on Docker 1.5 | |
# make the following the command for docker-compose.yml | |
# You will obviously first need to do a chmod +x on docker-compose-web-up.sh and add it to your docker container. | |
# command: bash docker-compose-web-up.sh | |
# See https://github.com/chiedojohn/django-starter for implementation example. | |
# Wait a couple seconds to make sure this output is the last thing in the console | |
sleep 2 | |
# Get the container ID | |
CONTAINER_ID="$(cat /proc/self/cgroup | grep "docker" | sed s/\\//\\n/g | tail -1)" | |
# Print out the command needed to enter the docker web container | |
printf "\nTo enter your Docker web container, run the below:\n------------\ndocker exec -it ${CONTAINER_ID} bash\n" | |
# The below is a hackish way to make the web container run indefinitely until stopped | |
tail -f /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment