
Rebuild all images, create all containers, and start all containers (Compose):. Build, create, and start all in the background (Compose):. (This will not rebuild images if a Dockerfile changes.) Build new images, create all containers, and start all containers (Compose). Run a container, setting an environment variable in the container:ĭocker run -env MY_ENVIRONMENT_VAR=myvalue my-image. Create a container from my-image, named my_container, and start it:. Run and remove the container after it exits:. Run the echo command in the container instead of the default command:. Create a container from my-image, and run the default command:. (This will not rebuild images if a Dockerfile changes.) docker-compose up -no-startĭocker run is a combination of (optionally) docker pull, docker create, and docker start. Build new images and create all containers (Compose). where my_service is one of the services listed in the docker-compose.yml file. Build an image using a differently-named Dockerfile:ĭocker build -f Dockerfile-other -t my-image. Build an image from a Dockerfile in the current directory:.
Login to the Docker registry ( ):ĭocker tag my-image my-username/my-repo:my-tag.See also: Get started with Docker - Share you image Pull and image from the Docker registry ( ):.Stop and remove containers and networks in docker-compose.yml.
Remove all unused containers, networks, and images (both dangling and unreferenced):ĭocker icon -> Troubleshoot -> Reset to factory defaults.