docker related commands

1. Stop all containers so that the images in them can be deleted:

docker stop $(docker ps -a -q)

If you want to delete all containers, add another command:

docker rm $(docker ps -a -q)

2. View what images are currently available

docker images

3. Delete images, specify who to delete through the id of the image

docker rmi <image id>

4. Create a custom image, create a new Dockerfile, and execute docker build -t docker/sb1 in this directory.

 docker/sb1 is the text of the new image;

5. Run the image image, docker run -d -p 8080:8080 docker/sb1;

-d is running in the background, the first 8080 is the port to be published to the local machine, the last 8080 is the port to be published to the outside world, and docker/sb1 is the name of the image to be run;

6. View all container status: docker ps

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324654398&siteId=291194637