3. Basic Commands - Mark-van-B/IT-Landscape-UCLL- GitHub Wiki
While these commands work with most Command-Line Interfaces (like the "cmd" we used during installation), it's useful to know that Docker Desktop has its own CLI built in, which can be reached by simply clicking on ">_ Terminal" at the bottom of the window.
Note: The terms written like "<...>" are to be replaced by the relevant names and file locations, for example: docker build -t MyApp
.
(These are the software packages, containers are runtime instances of images)
- Build an Image from a Dockerfile:
-
docker build -t <image_name>
(the -t stands for "tag", so whatever follows will be set as the name of the Image)
-
- List all local Images:
docker images
- Delete an Image:
docker rmi <image_name>
(These are the environments in which an Image is being run)
- Create and run from an Image, with a custom name.
docker run --name <container_name> <image_name>
- Start an existing container:
docker start <container_name>
- Stop an existing container:
docker stop <container_name>
- List running containers:
-
docker ps
(add--all
at the end if you want to include stopped containers as well)
-
For a more complete overview, please consult the Docker Cheatsheet.