Explain the function of static keyword and final keyword in Java in detail>>>
Problem phenomenon:
Export container snapshot through docker export:
1 docker export nginxDockerfileCopy > nginxDockerfileCopy.tar
View under current operation path: generated:
Then, the exported compressed package is imported as an image through docker import
1 cat exportContainerSnapshot/nginxDockerfileCopy.tar | docker import - username/nginx-importsnapshot
The query shows that the image has been generated
Next, docker run runs the image generation container
1 docker run --name testImportSnapshot -p 8084:80 -d username/nginx-importsnapshot
Error:
Solution:————————
According to the prompt, you need to specify the command. So, try adding the command after docker run:
1 docker run --name nginxDockerfileCopy -p 8093:80 -d username/nginx-dockerfilecopy /bin/bash
The execution is successful and no error is reported. However, access to nginx is not available
Query the status of the container and find that it has stopped. Although the – D background execution parameter is added in the execution, it stops automatically. It seems that the/bin/bash command is not enough to start nginx
Because this is a snapshot exported from the container “nginxdockerfilecopy”, I checked the command parameter of “nginxdockerfilecopy”:
Refer to the above command and change the run command to:
docker run --name testImportSnapshot -p 8094:80 -d username/nginx-importsnapshot nginx -g 'daemon off;'
At this point, view the container status:
The container is in the start state
Browser access: http://localhost : 8094/index.html to see the nginx page
Visit: http://localhost : 8094/haha.html this is the existing accessible page when exporting from the container “nginxdockerfilecopy”. It can also be accessed normally
It shows that the container snapshot is exported and imported to generate a new image, and the new image is executed to generate a container. The container has the same function as before export
Similar Posts:
- docker: Error response from daemon: Conflict. The container name “/xx” is already in use
- [Solved] Docker rmi Error: Error response from daemon: conflict: unable to delete 6c20ffa54f86 (must be forced) – image is being used by stopped container 6e81c0d9b6ab
- Docker OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caus
- Docker Container Performance Monitoring Tool: google/cadvisor
- [Solved] docker nginx localhost connection refused connect() failed (111: Connection refused)while connecting to upstream
- [Solved] Nginx Log Error: open() “/opt/Nginx/nginx/nginx.pid” failed (2: No such file or directory)
- How to Solve docker /docker-entrypoint.sh Error
- How to Solve docker run Error: oci runtime error
- “Docker build” requires exactly 1 argument [How to Solve]
- docker: Get https://registry-1.docker.io/v2/: x509: certificate is valid for *.xenahubs.net, not …