Home > Article > Operation and Maintenance > How to solve the problem that docker import cannot be used
Solution to the problem that docker import cannot be used: 1. Find the ENV parameter and append all its "key=value" strings to the file specified by "--env-file"; 2. Run the command "docker ps -a".
The operating environment of this article: ubuntu 16.04 system, Docker version 20.10.11, Dell G3 computer.
How to solve the problem that docker import cannot be used?
The import cannot run successfully after Docker export.Solution
Scenario:
1. Use docker export {containerName } -o {fileName} to export the container
2. Use docker import {fileName } {containerName} to import
3. Use docker Unable to run successfully after running:
4. Use –env-file to specify the file to manually set environment variables
Solution:
Manually using –env-file will remove the original ENV variables of the container, so you need to find the old (before export) container and use the docker inspect command to find the ENV parameters and append all its key=value strings Go to the file specified by –env-file
Run the command docker ps -a to view the "COMMAND" column of the container before exporting. This column is the command when the container is started. Please change it Append to docker run..., use "docker ps -a --no-trunc" to view complete information
Recommended learning: "docker video tutorial》
The above is the detailed content of How to solve the problem that docker import cannot be used. For more information, please follow other related articles on the PHP Chinese website!