Docker - Basics Flashcards
CLI run a conatiner
docker run -dp tag-of-the-image
-d flag in run command
run the container in detached mode (in the background)
-p flag in run command
maps the hosts port to the containers port (3000:3000)
CLI to build a container image
docker build -t name(tag)-for-the-image
-t flag in build command
adds a tag or text name/label to reference the image
CLI list container ids
docker ps
Needed to run a build
Dockerfile in the root dir of the project, no extension
CLI to stop an image
docker stop image-id
CLI remove an image
docker rm
CLI stop and remove an image
docker rm -f
CLI create a named volume
docker volume create name-of-volume
CLI map volume to container with build
docker build -td port:port -v named-of-volume:/dir/location tag-of-container
CLI view the mountpoint of the volume
docker volume inspect name-of-volume
CLI view volume logs
docker logs -f volume-id
CLI start a dev-mode container
docker run -dp hostPort:conatinerPort -w working-directory -v bindmount-host-dir:container-dir image-to-use sh -c ‘command-to-run’