I have found myself learning and relearning Docker basics because I only dive into it every few months, and it took me several days just to find my notes from last time, so I am pushing this to my blog for safe keeping.

If this is your first time with Docker consider starting here with a tutorial, it helps you get started by either installing all the requisite bits locally or using an interactive online playground.

play-with-docker

Here are the commands I lean on most to manage my local Docker images and containers:

# Show a list of images
docker images
# Show a list of containers
docker container ls
docker ps
# start up a container from the dasblogweb:latest image
docker run -ti dasblogweb:latest
# Create a new image from a container (preferably after making changes you want to keep)
docker commit c5534sdf343 my-new-image
# Create an image from a dockerfile in this directory "."
docker build -t "some-image" .
# Tag your build 
docker tag mywebapp poppastring/mywebapp
# Push out to docker hub…
docker push poppastring/mywebapp
# Stop container with id d86ead82e236
docker stop d86ead82e236
# Remove all containers
docker rm $(docker ps -a -q)
# List only the stopped containers
docker ps --filter "status=exited"
# Force delete image
docker rmi asdf8wewrw –f
# Force delete all images
docker rmi $(docker images -q)


Comment Section

Comments are closed.