株式会社コーソル

コーソルDatabaseエンジニアのブログ

技術ブログ

  • Linux
  • 2015.12.11
  • 渡部 亮太

Oracle Linux 6で初docker

RHEL6およびCentOS 6でDockerがサポートされていないという情報を見かけて、ぬぬぬと思っていたところ、

Installation on Oracle Linux

Docker is supported Oracle Linux 6 and 7.

を見つけて、元気がでてきたので初挑戦。

dockerのyumリポジトリを追加

# tee /etc/yum.repos.d/docker.repo <<-EOF
> [dockerrepo]
> name=Docker Repository
> baseurl=https://yum.dockerproject.org/repo/main/oraclelinux/6
> enabled=1
> gpgcheck=1
> gpgkey=https://yum.dockerproject.org/gpg
> EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/oraclelinux/6
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

dockerをyumでインストール

パッケージ名はdocker-engineでした。

# yum install docker
Loaded plugins: security, ulninfo
Setting up Install Process
dockerrepo                                               | 2.9 kB     00:00
dockerrepo/primary_db                                    | 6.1 kB     00:00
No package docker available.
Error: Nothing to do

# yum install docker-engine
Loaded plugins: security, ulninfo
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.9.1-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch          Version             Repository         Size
================================================================================
Installing:
 docker-engine        x86_64        1.9.1-1.el6         dockerrepo        8.1 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 8.1 M
Installed size: 35 M
Is this ok [y/N]: y
Downloading Packages:
docker-engine-1.9.1-1.el6.x86_64.rpm                     | 8.1 MB     00:00
warning: rpmts_HdrFromFdno: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
Retrieving key from https://yum.dockerproject.org/gpg
Importing GPG key 0x2C52609D:
 Userid: "Docker Release Tool (releasedocker) "
 From  : https://yum.dockerproject.org/gpg
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : docker-engine-1.9.1-1.el6.x86_64                             1/1
  Verifying  : docker-engine-1.9.1-1.el6.x86_64                             1/1

Installed:
  docker-engine.x86_64 0:1.9.1-1.el6

Complete!

dockerを起動してサンプルを動かしてみる

# service docker start
Starting docker:        .                                  [  OK  ]
# ps -ef | grep docker
root      6758     1  0 10:20 pts/0    00:00:00 /usr/bin/docker daemon
root      6796  6758 10 10:20 pts/0    00:00:00 mkfs.ext4 -E nodiscard,lazy_itable_init=0,lazy_journal_init=0 /dev/mapper/docker-252:0-656137-base
root      6800 10488  0 10:20 pts/0    00:00:00 grep docker
# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b901d36b6f2f: Pull complete
0a6ba66e537a: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest

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.
 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 Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

# docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
0bf056161913: Pull complete
1796d1c62d0c: Pull complete
e24428725dd6: Pull complete
89d5d8e8bafb: Pull complete
Digest: sha256:a2b67b6107aa640044c25a03b9e06e2a2d48c95be6ac17fb1a387e75eebafd7c
Status: Downloaded newer image for ubuntu:latest
root@1924455023e5:/# uname -a
Linux 1924455023e5 3.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
root@1924455023e5:/#

無事動いたようです。 🙂

プロフィール

On7tWW6m1Ul4

渡部 亮太

・Oracle ACE
・AWS Certified Solutions Architect - Associate
・ORACLE MASTER Platinum Oracle Database 11g, 12c 他多数

カテゴリー

アーカイブ