Get started with Docker for Mac: https://docs.docker.com/docker-for-mac/
Docker Orientation: https://docs.docker.com/get-started/
Docker CLI Reference: https://docs.docker.com/engine/reference/commandline/cli/
Best practices for writing Dockerfiles: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
Docker Tutorials: https://github.com/docker/labs/
Docker Engine user guide: https://docs.docker.com/engine/userguide/
Glossary: https://docs.docker.com/glossary/
Docker Cheat Sheet
docker ps
- what docker images are runningdocker ps -a
- all images, even ones that were scheduled and dieddocker images
- lists images available locallydocker build -t me/locations-api .
- builds your image based on your current directory's dockerfile called "me/locations-api"docker run
- runs a prebuilt docker imagedocker run -p 1492:3000 --env-file .env -d me/locations-api
-d
is daemon mode, so it doesn't lock up your terminal. If it's in daemon mode, you have to explicitlydocker stop
itdocker exec -i -t me/locations-api bash
docker logs -f #{CONTAINER_ID}
- tailing logs to stderr or stdout (follow)docker stop #{CONTAINER_ID}
- stop running docker containerBuilding Dockerfile
Docker tries to cache all commands in the Dockerfile. Every command becaomes a Docker layer. It's also read in order. Typically you want to have things that change often at the bottom, and things that change often on top, to prevent from rebuilding unnecesarry layers all the time.
FROM
- You can have Dockerfiles inherit from the same base layerRUN
- typically busts cache. All these commands happen in one layerADD
- unpacking a tar that is local, or adding a url that's available publicallyCOPY
- more ideal than add if you're just trying to copy files overJohn's gist
Get started with Docker for Mac: https://docs.docker.com/docker-for-mac/
Docker Orientation: https://docs.docker.com/get-started/
Docker CLI Reference: https://docs.docker.com/engine/reference/commandline/cli/
Best practices for writing Dockerfiles: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
Docker Tutorials: https://github.com/docker/labs/
Docker Engine user guide: https://docs.docker.com/engine/userguide/
Glossary: https://docs.docker.com/glossary/