Skip to content

Instantly share code, notes, and snippets.

@crshmk
Last active March 14, 2021 00:09
Show Gist options
  • Save crshmk/e77c9bf5d75b1f80866481980bff306f to your computer and use it in GitHub Desktop.
Save crshmk/e77c9bf5d75b1f80866481980bff306f to your computer and use it in GitHub Desktop.
Standard Docker commands
# download and run an image
docker run image-name
# list images
docker images
# build an image
docker build -t image-name <path>
# run an image
docker run --name container-name -p 8080:8080 -d image-name
# list running containers
docker ps
# list all containers
docker ps -a
# get more container info
docker inspect container-name
#run a shell inside a container
docker exec -it container-name bash
# ps aux inside the shell shows processes running on the host OS, but namespaced for this container
# stop running container
docker stop container-name
docker stop container-id
# rm container
docker rm container-name
# tag your image for docker hub
docker tab image-name <dockerHubId>/image-name
# push to docker hub https://hub.docker.com
docker push <dockerHubId>/image-name
# terminal log into docker hub
docker login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment