Home > Operation and Maintenance > Docker > How to solve the problem that docker import cannot be used

How to solve the problem that docker import cannot be used

藏色散人
Release: 2021-12-31 11:41:31
Original
3764 people have browsed it

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".

How to solve the problem that docker import cannot be used

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template