环境:? ?win10? WSL 环境?
时间:2024.01.03
docker ?容器 导入导出:
导出:成功
PS C:\Users\Administrator> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ec512bb2776f testcontainers/helloworld "/helloworld" 8 minutes ago Up 4 seconds 0.0.0.0:8080-8081->8080-8081/tcp nostalgic_booth
PS C:\Users\Administrator> docker export ec512bb2776f > hangger_server.tar
导入:失败
PS C:\Users\Administrator> docker import - new_hangger_server < hangger_server.tar
所在位置 行:1 字符: 36
+ docker import - new_hangger_server < hangger_server.tar
+ ~
“<”运算符是为将来使用而保留的。
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RedirectionNotSupported
PS C:\Users\Administrator> docker import - new_hangger_server hangger_server.tar
以上方法不可用~!!!!!!!!!!!!!
docker? 镜像 导入导出:
导出:成功~!
docker save 6974669be52b -o helloie.tar
PS C:\Users\Administrator\Videos> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
new_hangger_server latest 62ac4ec7be67 12 minutes ago 0B
talebook/talebook latest b4c7fc60b897 4 days ago 2.14GB
hello-world latest d2c94e258dcb 8 months ago 13.3kB
testcontainers/helloworld latest 6974669be52b 3 years ago 12.7MB
PS C:\Users\Administrator\Videos> docker save 6974669be52b -o helloie.tar
导入:成功
docker load -i helloie.tar
PS C:\Users\Administrator\Videos> docker load -i helloie.tar
Loaded image ID: sha256:6974669be52b12a9103072cbad3e13fbf119b76aa09747f19a821a5eaad34be1
PS C:\Users\Administrator\Videos> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
talebook/talebook latest b4c7fc60b897 4 days ago 2.14GB
hello-world latest d2c94e258dcb 8 months ago 13.3kB
<none> <none> 6974669be52b 3 years ago 12.7MB
问题:导入后的镜像没有名称和标签:
解决办法 重命名:
docker tag 6974669be52b hello-ie:v1.0
PS C:\Users\Administrator\Videos> docker tag 6974669be52b hello-ie:v1.0
PS C:\Users\Administrator\Videos> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
talebook/talebook latest b4c7fc60b897 4 days ago 2.14GB
hello-world latest d2c94e258dcb 8 months ago 13.3kB
hello-ie v1.0 6974669be52b 3 years ago 12.7MB
运行容器:
PS C:\Users\Administrator\Videos> docker run -p 8080:8080 -p 8081:8081 -e DELAY_START_MSEC=2000 hello-ie:v1.0
2024/01/03 12:21:34 DELAY_START_MSEC: 2000
2024/01/03 12:21:34 Sleeping for 2000 ms
2024/01/03 12:21:36 Starting server on port 8080
2024/01/03 12:21:36 Sleeping for 2000 ms
2024/01/03 12:21:38 Starting server on port 8081
2024/01/03 12:21:38 Ready, listening on 8080 and 8081
172.17.0.1 - - [03/Jan/2024:12:21:40 +0000] "GET / HTTP/1.1" 304 0
运行成功···························~!