Skip to content

Instantly share code, notes, and snippets.

@franckweb
Last active March 21, 2023 02:32
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 franckweb/d35c2412da3f9720e3e048ee6d392d6e to your computer and use it in GitHub Desktop.
Save franckweb/d35c2412da3f9720e3e048ee6d392d6e to your computer and use it in GitHub Desktop.
Docker commands
## Add current logged in linux user to docker group
1. sudo usermod -aG docker ${USER}
# To apply the new group membership, log out of the server and back in, or type the following:
2. su - ${USER}
# You will be prompted to enter your user’s password to continue.
# Confirm that your user is now added to the docker group by typing:
3. groups
# Output: yourusername sudo docker
------------
## If you can not add user to docker group (msg: user does not exists)
# edit /user/passwd manually and add your user with
sudo vipw
# also for consistency add user also to /etc/shadow with
sudo vipw -s
# and then follow steps 1 and 2 listed above
------------
## IMAGES
docker images -a
docker rmi IMAGE_NAME
## CONTAINERS
docker ps
docker stop CONTAINER_NAME
docker rm CONTAINER_NAME
## VOLUMES
docker volume ls
docker volume rm VOLUME_NAME
## DOCKER IP
docker-machine ip
(ej:192.168.99.100 visitable en browser)
## DOCKER COMPOSE
docker-compose up -d (runs containers)
docker-compose stop (stops containers)
## SOURCES
# Docker LEMP: https://github.com/cytopia/devilbox
# Docker LEMP: https://www.youtube.com/watch?v=M1j41ud2O-M
# Docker + Python https://www.youtube.com/watch?v=Qw9zlE3t8Ko
# Remove docker images, container and volumes: https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment