4
4

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 5 years have passed since last update.

CentOSへDockerのインストール

Last updated at Posted at 2015-06-03

Procedure

参考サイト

:one: CentOSにログインし、yumでインストール
sudo yum install -y docker
※sudoの設定は省略

lang インストール: docker.x86_64 0:1.6.0-11.0.1.el7.centos 依存性関連をインストールしました: docker-selinux.x86_64 0:1.6.0-11.0.1.el7.centos 完了しました!
となれば、インストール完了。
:two: dockerのサービスを起動
sudo service docker start

:three: centosのimageを取得。77MB。結構時間がかかる。
docker pull {イメージ名}:{タグ名}
で指定したタグのイメージをDockerリポジトリから取得してくるらしい。
どこから取得するかも指定できるみたいで、デフォルトではDocker Hub Resistryとなっているようだ。
sudo docker pull centos

:four: imageを確認する。
sudo docker images centos
[test@localhost ~]$ sudo docker images centos REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
何も出てこない。ここでcentosのイメージが出てくるはずだが・・・。はて?

sudo docker images
とすると、centosが表示された。docker.io/centosになっているからのようだ。
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE docker.io/centos latest fd44297e2ddb 6 weeks ago 215.7 MB

:five: imageの起動
sudo docker run -i -t centos /bin/bash

これで、コンテナが起動した、のか?

bin  etc   lib    lost+found  mnt  proc  run   srv  tmp  var
dev  home  lib64  media       opt  root  sbin  sys  usr
[root@0c9bc4668f1c /]# pwd
/
[root@0c9bc4668f1c /]# id
uid=0(root) gid=0(root) groups=0(root)
[root@0c9bc4668f1c /]# 
4
4
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
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?