Skip to content

Instantly share code, notes, and snippets.

@AshishPandagre
Created January 23, 2022 04:56
Show Gist options
  • Save AshishPandagre/662fb846000dffde6ee5b831abb6bcb0 to your computer and use it in GitHub Desktop.
Save AshishPandagre/662fb846000dffde6ee5b831abb6bcb0 to your computer and use it in GitHub Desktop.
basic docker commands
docker pull redis // can be found from docker hub
docker images // all existing images
docker run redis:4.0 // pulls image and starts container
docker run redis // starts the image in a container
docker run -p6000:6379 redis // starts container at 6000 laptop port -> 6379 container port.
docker run -d redis // runs container in detached (bg) mode, and only returns id of container
docker stop <id> // stops a running container
docker start <id> // starts a previously stopped container
docker ps // lists running containers
docker ps -a // lists running and stopped containers
docker logs <id> // logs
docker logs <name> // logs
docker run -d -p6000:6379 --name my_redis_name redis // container with a custom name
docker exec -it <id or name> /bin/bash // to get into cli of that container, example to check some data or env vars.
exit // to exit from terminal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment