2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dockerでCentOSのイメージを使ってみる

Posted at

環境情報

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

手順

centos7のイメージを取得

docker pull centos:7

実行結果

[root@centos-sample aky100200]# docker pull centos:7
7: Pulling from library/centos
ab5ef0e58194: Pull complete
Digest: sha256:4a701376d03f6b39b8c2a8f4a8e499441b0d567f9ab9d58e4991de4472fb813c
Status: Downloaded newer image for centos:7
docker.io/library/centos:7
[root@centos-sample aky100200]#

イメージの確認

docker images

実行結果

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

起動

docker run -it -d --name centos7 centos:7

実行結果

[root@centos-sample aky100200]# docker run -it -d --name centos7 centos:7
fdc5ffc971420c60228330c1b9f7b4030878836e74f5590614774e8d35518694
[root@centos-sample aky100200]#

プロセスの起動を確認

docker ps

実行結果

[root@centos-sample aky100200]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
fdc5ffc97142        centos:7            "/bin/bash"         About a minute ago   Up About a minute                       centos7
[root@centos-sample aky100200]#

コンテナ内コマンドの実行

docker exec -it centos7 /bin/bash

実行結果

[root@centos-sample aky100200]# docker exec -it centos7 /bin/bash
[root@fdc5ffc97142 /]#

まとめ

イメージの作成ができた。

参考

2
2
0

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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?