Docker Basic Command Summary

Source: Internet
Author: User
Tags docker ps docker run

Docker Info display Docker details
Docker Pull BusyBox Image
Docker Pull Nginx
Docker Images Nginx view a running mirror
Docker run--name nginx01-d-P 8099:80 Nginx uses an nginx image to start a container named NGINX01 and maps 8099 ports so we can access Nginx directly:
Firefox 127.0.0.1:8099
Now, assuming we don't like the Welcome page very much, we want to change to welcome Docker text, and we can use the Docker EXEC command to go into the container and modify its contents.
Docker exec-it nginx01 Bash
echo ' We modified the container's file, which changed the storage layer of the container. We can see the specific changes through the Docker diff command.
Docker commit command:
You know, when we run a container (if we don't use a volume), any file modifications we make will be recorded in the container storage layer. Docker provides a docker commit command to save the container's storage layer as a mirror. In other words, on the basis of the original image, the storage layer of the container is superimposed and the new image is formed. Later, when we run this new image, we will have the last file change of the original container.
We can save the container as a mirror with the following command
Docker commit \
--author "Tao Wang <[email protected]>" \
--message "modified default webpage" \
Webserver \
Nginx:v2
Docker run--name web2-d-P 81:80 nginx:v2
Here we name the new service for WEB2, and map to port 81.
Visit Nginx again to find the Welcome page has changed

    docker ps -l                查看正在运行的容器    docker rm -f nginx01  删除容器         若想删除镜像 必须先删除此镜像下面的容器    docker  rmi    IMAGE ID  删除镜像    [[email protected] html]# docker exec -it nginx01 bash  进入 nginx01容器

Summary of Docker Foundation commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.