Jul 11, 2024
docker run
to pull and start containers.docker stop
and docker start
to manage running containers.-p
flag.docker logs
to view logs.docker exec
to access container terminals for debugging.docker-compose.yaml
file.docker-compose up
to start all services and docker-compose down
to stop them.FROM
and add application dependencies and code.RUN
to execute commands and COPY
to include local files.CMD
.docker build
to create an image.docker push
to upload images to repositories (e.g., AWS ECR).docker-compose.yaml
.docker-compose up
.volumes
attribute to map host directories to container paths./var/lib/docker/volumes
.docker pull [image]
: Pull an image from a registry.docker run [options] [image]
: Run a container from an image.docker stop [container_id]
: Stop a running container.docker start [container_id]
: Start a stopped container.docker ps [-a]
: List running (or all) containers.docker images
: List local images.docker logs [container_id]
: View container logs.docker exec -it [container_id] [command]
: Run a command in a running container.docker rm [container_id]
: Remove a stopped container.docker rmi [image_id]
: Remove an image.docker-compose up [-d]
: Start containers as defined in docker-compose.yaml
.docker-compose down
: Stop and remove containers, networks, volumes defined in docker-compose.yaml
.