Docker Cheat Sheet

The docker cheat sheet is just meant to be a list of commands that I’ve found useful when working with Docker. This is provided with little in the way of explanation or instruction. I’ll be providing the details in articles that will follow.


Build an image

docker build . -t [accountname/imagename] -f [dockerfile name]


docker build . -t jakewatkins/exampleapp0831 -f dockerfile.standalone


Create a container

docker create -p [port mapping] –name [container name] [image name]


docker create -p 3000:80 –name testcontainer jakewatkins/exampleapp0831


Start a container

docker start [container name]


docker start testcontainer


Just run the container

docker run -p [port mapping] –name [container name] [image name]


docker run -p 3000:80 –name testcontainer jakewatkins/exampleapp0831


Get the logs from a running container

docker logs [container name]


docker logs testcontainer


Run an image, give me a shell and then remove the container when I exit:

docker run -it –rm [image name]


Docker run -it –rm jakewatkins/example0831

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s