アジェンダ
Docker 日本語環境構築まとめ 2 ではコンテナの作成を行った
今回はDocker HUBにpush して、別の環境にpullして問題なく動作するかを確認
1 docker hub アカウントを作成
2 docker hub へpush
3 docker hubからpull
Docker hub アカウントを作成
さくっと作成してPUBLICリポジトリを作成
Docker HUB へPUSH
PUSH事前準備
== act_chkが今回のpush対象
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
act_chk 1.0 d2b0a3cbbbac About a minute ago 588MB
centos 7 1e1148e4cc2c 6 weeks ago 202MB
== imageにtagをつける(これはそういうものらしい)
$ docker tag 6aeea82f960e testrepo/act_chk
== testrepo/act_chkが生成されたことを確認
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
testrepo/act_chk 1.0 6aeea82f960e 42 seconds ago 593MB
PUSH実施
== DockerへLogin
$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you dont have a Docker ID, head over to https://hub.docker.com to create one.
Username:hogehoge
Password:gehogeho
Login Succeeded
== IMAGE PUSH
$ sudo docker push testrepo/act_chk
The push refers to a repository [docker.io/testrepo/act_chk]
2bcc1252b7ad: Pushed
1331528ff616: Pushed
d57def62f544: Pushed
27d4db461b52: Pushed
2fc48bf3da31: Pushed
99f4747d2a4a: Pushed
f6dc2798d70c: Pushed
b90dc3d25361: Pushed
747eeabe80dd: Pushed
eb952584ebb9: Pushed
de2ec3e21cc6: Pushed
a894ae46cc19: Pushed
728f93651666: Pushed
071d8bd76517: Pushed
latest: digest: sha256:9cdc5024ef2b63ff48067238b9cc7cced0991a969b0daa5824be18d83715faaa size: 3254
== docker hubにアップされたか確認
$ docker search testrepo/act_chk
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
testrepo/myrepo my repository 0
Docker HUBからPull
DockerからPULL
$ docker pull testrepo/act_chk
Using default tag: latest
latest: Pulling from testrepo/act_chk
8916107b7fae: Already exists
807abbb65063: Already exists
5991b49bc876: Already exists
78ac93d75044: Already exists
063cf6fa0d85: Already exists
7c2d8f980833: Already exists
f46c813112a1: Already exists
97e17532bf58: Already exists
8529d649ea20: Already exists
bccb4d123194: Already exists
7dfd60428730: Already exists
35b6427a6fda: Already exists
59f469d51050: Already exists
bf846dc1ab25: Pull complete
Digest: sha256:9cdc5024ef2b63ff48067238b9cc7cced0991a969b0daa5824be18d83715faaa
Status: Downloaded newer image for testrepo/act_chk:latest
== リポジトリからimageがpullされたことを確認
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
testrepo/act_chk latest 6aeea82f960e 20 minutes ago 593MB
act_chk 1.0 134117fc62d9 2 hours ago 593MB
centos 7 1e1148e4cc2c 6 weeks ago 202MB
== imageからコンテナ作成
$ docker run -it --hostname="act_chk" -d --name="act_chk" 6aeea82f960e /bin/bash
== コンテナ確認
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39842eaa93fe 6aeea82f960e "/bin/bash" 3 seconds ago Up 2 seconds a_b_cact_chk_main
315521ef9bae 134117fc62d9 "/bin/bash" 2 hours ago Up 2 hours act_chk
== attachして確認
$ docker attach act_chk
$ cd /home/
$ ll
total 16
-rw-r--r-- 1 root root 847 1月 18 16:42 test
dockerhub作成 ⇒ image push ⇒ image pullを行って環境が元通りに構築された事を確認できた
とりあえず一旦ここまで〜