Skip to content

Instantly share code, notes, and snippets.

@freshjones
Created January 14, 2015 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freshjones/c1b0a72e7123cb8c7e0a to your computer and use it in GitHub Desktop.
Save freshjones/c1b0a72e7123cb8c7e0a to your computer and use it in GitHub Desktop.
Update a running docker container
#!/bin/bash
echo "stop running container"
sudo docker stop <container_name>
echo "remove container"
sudo docker rm <container_name>
echo "remove current image"
sudo docker rmi <image>:current
echo "boot the container with latest"
sudo docker run -d -p <port>:<port> --name <container_name> <image>:latest
echo "tag a new current image"
sudo docker tag <image>:latest <image>:current
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment