1
0

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.

Virtualbox 上の Amazon Linux 2 に Docker をインストールする

Posted at

Amazon Linux 2 の初期設定を備忘録として記録する。

環境

Windows 10 Pro
Virtualbox 6.0.4
Amazon Linux 2

必要なパッケージをインストール

$ sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

Docker インストール

$ sudo yum -y install docker
Loaded plugins: langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 0:18.06.1ce-7.amzn2 will be installed
--> Processing Dependency: pigz for package: docker-18.06.1ce-7.amzn2.x86_64
--> Processing Dependency: libcgroup for package: docker-18.06.1ce-7.amzn2.x86_64
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-18.06.1ce-7.amzn2.x86_64
--> Running transaction check
---> Package libcgroup.x86_64 0:0.41-15.amzn2 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.2.amzn2.0.2 will be installed
---> Package pigz.x86_64 0:2.3.4-1.amzn2.0.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================
 Package                  Arch               Version                             Repository                     Size
=====================================================================================================================
Installing:
 docker                   x86_64             18.06.1ce-7.amzn2                   amzn2extra-docker              37 M
Installing for dependencies:
 libcgroup                x86_64             0.41-15.amzn2                       amzn2-core                     65 k
 libtool-ltdl             x86_64             2.4.2-22.2.amzn2.0.2                amzn2-core                     49 k
 pigz                     x86_64             2.3.4-1.amzn2.0.1                   amzn2-core                     81 k

Transaction Summary
=====================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 37 M
Installed size: 151 M
Downloading packages:
(1/4): libtool-ltdl-2.4.2-22.2.amzn2.0.2.x86_64.rpm                                           |  49 kB  00:00:00
(2/4): libcgroup-0.41-15.amzn2.x86_64.rpm                                                     |  65 kB  00:00:00
(3/4): pigz-2.3.4-1.amzn2.0.1.x86_64.rpm                                                      |  81 kB  00:00:00
(4/4): docker-18.06.1ce-7.amzn2.x86_64.rpm                                                    |  37 MB  00:00:26
---------------------------------------------------------------------------------------------------------------------
Total                                                                                1.3 MB/s |  37 MB  00:00:29
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pigz-2.3.4-1.amzn2.0.1.x86_64                                                                     1/4
  Installing : libtool-ltdl-2.4.2-22.2.amzn2.0.2.x86_64                                                          2/4
  Installing : libcgroup-0.41-15.amzn2.x86_64                                                                    3/4
  Installing : docker-18.06.1ce-7.amzn2.x86_64                                                                   4/4
  Verifying  : libcgroup-0.41-15.amzn2.x86_64                                                                    1/4
  Verifying  : docker-18.06.1ce-7.amzn2.x86_64                                                                   2/4
  Verifying  : libtool-ltdl-2.4.2-22.2.amzn2.0.2.x86_64                                                          3/4
  Verifying  : pigz-2.3.4-1.amzn2.0.1.x86_64                                                                     4/4

Installed:
  docker.x86_64 0:18.06.1ce-7.amzn2

Dependency Installed:
  libcgroup.x86_64 0:0.41-15.amzn2   libtool-ltdl.x86_64 0:2.4.2-22.2.amzn2.0.2   pigz.x86_64 0:2.3.4-1.amzn2.0.1

Complete!

Docker デーモンを起動

$ sudo systemctl start docker
$ sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

hello-world

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
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.
    (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/
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?