退役SEのつれづれ日記

定年退役SEが、つれづれなる想いをしたためています。
(旧名:『システムノヲニワソト』)

[docker][SoftwareDesign連載]応用がきくDockerイメージの作り方(series8)

2020-03-17 | Weblog
第八回の復習。(2019年6月号)
今回は、「Docker Hubで自作イメージを公開する」です。
DockerHubにrepositoryを作成して、イメージを保存してみましょう。

この確認作業を開始してからずいぶんと時間が経ってしまいましたが、
さくっと行ってみます。

[user@hogehoge docker-centos7-mrtg]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
centos7               mrtg                83ce2c31d9cf        8 minutes ago       622MB
centos                centos7             67fa590cfc1c        2 months ago        202MB
aws-client            latest              507d1a3b95da        4 months ago        495MB
ubuntu                latest              7698f282e524        5 months ago        69.9MB
[user@hogehoge docker-centos7-mrtg]# docker image tag centos7:mrtg hogehoge000/sdtest:latest
[user@hogehoge docker-centos7-mrtg]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
centos7               mrtg                83ce2c31d9cf        8 minutes ago       622MB
hogehoge000/sdtest   latest              83ce2c31d9cf        8 minutes ago       622MB
centos                centos7             67fa590cfc1c        2 months ago        202MB
aws-client            latest              507d1a3b95da        4 months ago        495MB
ubuntu                latest              7698f282e524        5 months ago        69.9MB
[user@hogehoge docker-centos7-mrtg]# docker login
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
[user@hogehoge docker-centos7-mrtg]# docker push hogehoge000/sdtest
The push refers to repository [docker.io/hogehoge000/sdtest]
d1a980d926bb: Pushed
6abd4f348e05: Pushed
747702f91d47: Pushed
4b5b6659000d: Pushed
8f2a633f8af3: Pushed
8f2a633f8af3: Pushed
b3762f4ecba6: Pushed
de5648319fd9: Pushed
e4c636a75093: Pushed
3e7257272b69: Pushed
f8b2fff53960: Pushed
bea4f18783df: Pushed
df69f23d4499: Pushed
005b182e9dc2: Pushed
e8f5145ad381: Pushed
4d495aea95b4: Pushed
2f742692c5d9: Pushed
f7a6c5b62281: Pushed
8bef5b0f7f29: Pushed
200b486a8aec: Pushed
4ee4b7bdec47: Pushed
40479bbad36a: Pushed
cc11265828eb: Pushed
03ffc2069dae: Pushed
827e960ea415: Pushed
5cf630177da5: Pushed
f68d1ce24a02: Pushed
32873560ea1c: Pushed
65198bedad6b: Pushed
b6debfc0fca1: Pushed
aad17867f80f: Pushed
97a796fec8bb: Pushed
a5d5f49edc62: Pushed
46ac640ff425: Pushing [==================================================>]  106.6MB
0326a1081526: Pushing [============================>                      ]  126.1MB/221MB
0ad2bdb8fa27: Pushed
877b494a9f30: Mounted from library/centos


Pushed
877b494a9f30: Mounted from library/centos
latest: digest: sha256:212f86c3c38bfcc39fb10a9fa793845553d4bed714d854bc0cd4713d23e9e214 size: 7811


user@hogehoge docker-centos7-mrtg]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              centos7             67fa590cfc1c        2 months ago        202MB
aws-client          latest              507d1a3b95da        4 months ago        495MB
ubuntu              latest              7698f282e524        5 months ago        69.9MB
[user@hogehoge docker-centos7-mrtg]# docker run -it hogehoge000/sdtest:latest /bin/bash
Unable to find image 'hogehoge000/sdtest:latest' locally
latest: Pulling from hogehoge000/sdtest
d8d02d457314: Already exists
58bcd1da39c7: Pull complete
cbdfcc415de0: Extracting [==========================>                        ]  43.45MB/81.46MB
b1c61778169e: Download complete
3a0208391ef7: Download complete
45213ba02f91: Download complete
616f025e4178: Download complete
d5128c0bdd3f: Download complete
b30a681f9f91: Download complete
cb7b4359831a: Download complete
3f3fbf33d380: Download complete
86d628d8718f: Download complete
1938cb3fe426: Download complete
954af716557f: Download complete
da1606605be2: Download complete
2abf711ede69: Download complete
672d7d66d9ef: Download complete
78324c459157: Download complete
aacf03b2ecbd: Download complete
352e85102286: Download complete
578eda84ae72: Download complete
ae7eb830dec9: Download complete
7640b4c619bf: Download complete
e3412ecbcffa: Download complete
16f0b69cdb1c: Download complete
01e51acd856a: Download complete
7385808140c9: Download complete
c81113226f3a: Download complete
c93e842de334: Download complete
6af8e43c8c5c: Download complete
ba7205526380: Download complete
f884f84a55a7: Download complete
4acdcfc4a194: Download complete
34e7ff762664: Download complete
8bef588638bf: Waiting
7cb0aaf45228: Waiting

[user@hogehoge docker-centos7-mrtg]# docker run -it hogehoge000/sdtest:latest /bin/bash
Unable to find image 'hogehoge000/sdtest:latest' locally
latest: Pulling from hogehoge000/sdtest
d8d02d457314: Already exists
58bcd1da39c7: Pull complete
cbdfcc415de0: Pull complete
b1c61778169e: Pull complete
3a0208391ef7: Pull complete
45213ba02f91: Pull complete
616f025e4178: Pull complete
d5128c0bdd3f: Pull complete
b30a681f9f91: Pull complete
cb7b4359831a: Pull complete
3f3fbf33d380: Pull complete
86d628d8718f: Pull complete
1938cb3fe426: Pull complete
954af716557f: Pull complete
da1606605be2: Pull complete
2abf711ede69: Pull complete
672d7d66d9ef: Pull complete
78324c459157: Pull complete
aacf03b2ecbd: Pull complete
352e85102286: Pull complete
578eda84ae72: Pull complete
ae7eb830dec9: Pull complete
7640b4c619bf: Pull complete
e3412ecbcffa: Pull complete
16f0b69cdb1c: Pull complete
01e51acd856a: Pull complete
7385808140c9: Pull complete
c81113226f3a: Pull complete
c93e842de334: Pull complete
6af8e43c8c5c: Pull complete
ba7205526380: Pull complete
f884f84a55a7: Pull complete
4acdcfc4a194: Pull complete
34e7ff762664: Pull complete
8bef588638bf: Pull complete
7cb0aaf45228: Pull complete
Digest: sha256:212f86c3c38bfcc39fb10a9fa793845553d4bed714d854bc0cd4713d23e9e214
Status: Downloaded newer image for hogehoge000/sdtest:latest
[root@4e0d4cc00d66 /]# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 00:33 pts/0    00:00:00 /bin/bash
root        16     1  0 00:34 pts/0    00:00:00 ps -ef
[root@4e0d4cc00d66 /]# exit
exit
[user@hogehoge docker-centos7-mrtg]# docker ps -a
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS                     PORTS                                                              NAMES
26c8a4988f6f        hogehoge000/sdtest:latest   "/bin/bash"         52 seconds ago      Exited (0) 4 seconds ago                                                                      epic_heyrovsky
8814be1958be        aws-client:latest            "/bin/bash"         4 months ago        Up 4 months                0.0.0.0:80->80/tcp, 0.0.0.0:2812->2812/tcp, 0.0.0.0:8022->22/tcp   awscli
[user@hogehoge docker-centos7-mrtg]# docker rm -f epic_heyrovsky
epic_heyrovsky
[user@hogehoge docker-centos7-mrtg]# docker run -it hogehoge000/sdtest:latest
[root@4e0d4cc00d66 /]# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  1 00:35 pts/0    00:00:00 /bin/bash
root        16     1  0 00:35 pts/0    00:00:00 ps -ef
[root@4e0d4cc00d66 /]# exit
exit


一旦、目標達成です。

コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« [#redmine4.1][#plugin]redmi... | トップ | [#redmine4.1][#plugin]redmi... »