通过docker教程学习如何在mac上使用docker: https://docs.docker.com/userguide/dockerimages/
尝试更新并提交图像 收到我不理解的错误消息。
$docker pull training/sinatra
Pulling repository training/sinatra
...
79e6bf39f993: Download complete
Status: Downloaded newer image for training/sinatra:latest
$docker run -t -i training/sinatra /bin/bash
root@6a2012d33405:/# gem install json
Fetching: json-1.8.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-1.8.2
1 gem installed
Installing ri documentation for json-1.8.2...
Installing RDoc documentation for json-1.8.2...
root@6a2012d33405:/# exit
exit
$docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
...
hello-world latest 91c95931e552 6 weeks ago 910 B
training/sinatra latest f0f4ab557f95 11 months ago 447 MB
$docker commit -m "Added json gem" -a "Yours Truly" f0f4ab557f95 ouruser/sinatra:v2
FATA[0000] Error response from daemon: no such id: f0f4ab557f95
答案 0 :(得分:6)
看起来我使用了错误的ID “IMAGE ID”与“容器ID”不同 后者是在提示符“root @ 6a2012d33405”中出现在“root @”之后的内容 这有效:
$docker commit -m "Added json gem" -a "Yours Truly" 6a2012d33405 ouruser/sinatra:v2
36c544150c9405934674b52ffc447519cb428c0526607276daab56025dfd6b11
$docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ouruser/sinatra v2 36c544150c94 About a minute ago 452.1 MB
...
hello-world latest 91c95931e552 6 weeks ago 910 B
training/sinatra latest f0f4ab557f95 11 months ago 447 MB