Last active
October 6, 2021 09:54
-
-
Save Lucky-Loek/b8d9b043deb4be2e3b829b5d69d07f34 to your computer and use it in GitHub Desktop.
Docker workflow (also works in powershell)
This file contains 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
# After creating a Dockerfile | |
docker build -t {tag-name} . | |
# Run one-off commands that are visible on host in current directory: | |
# docker run | |
# --rm [remove container after done] | |
# -it [with an interactive shell] | |
# -v ${pwd}:/opt [with volume of present working directory mounted in /opt] | |
# -w [with container working directory of /opt] | |
# {container} [the container name] | |
# {command} [the command to run in container] | |
docker run --rm -it -v ${pwd}:/opt -w /opt {container} {command} | |
# Remove all dangling and stopped containers | |
docker system prune | |
# Remove all images | |
docker rmi $(docker images -q) | |
# List all volumes | |
docker volume ls | |
# Remove unnecessary volumes | |
docker volume rm {name} | |
# Remove all unnecessary volumes | |
docker volume rm $(docker volume ls -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment