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