LoginSignup
1
0

More than 3 years have passed since last update.

dockerでHelloWorldする

Last updated at Posted at 2020-02-11

dockerでHelloWorldする

環境情報

  • OS: Linux (centos 7.7.1908)
  • docker: 19.03.5

手順

イメージの一覧を確認する

docker images

まだ何もないことを確認

実行結果

[root@centos-sample aky100200]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
[root@centos-sample aky100200]#

Hello-Worldの準備

hello-worldイメージをpullする

docker pull hello-world

実行結果

[root@centos-sample aky100200]# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:9572f7cdcee8591948c2963463447a53466950b3fc15a247fcad1917ca215a2f
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest
[root@centos-sample aky100200]#

イメージが取得できているか確認

docker images

hello-worldが追加されている

[root@centos-sample aky100200]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        13 months ago       1.84kB
[root@centos-sample aky100200]#

Hello-World

実行

docker run hello-world

実行結果

[root@centos-sample aky100200]# docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[root@centos-sample aky100200]#

「Hello from Docker!」が出力されている。

まとめ

次はlinuxイメージを作りたい。

参考

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0