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]
example
docker build . -t jakewatkins/exampleapp0831 -f dockerfile.standalone
Create a container
docker create -p [port mapping] –name [container name] [image name]
Example
docker create -p 3000:80 –name testcontainer jakewatkins/exampleapp0831
Start a container
docker start [container name]
Example
docker start testcontainer
Just run the container
docker run -p [port mapping] –name [container name] [image name]
Example
docker run -p 3000:80 –name testcontainer jakewatkins/exampleapp0831
Get the logs from a running container
docker logs [container name]
Example
docker logs testcontainer
Run an image, give me a shell and then remove the container when I exit:
docker run -it –rm [image name]
Example
Docker run -it –rm jakewatkins/example0831