目的
目的は、ネイティブのDockerスクリプトを使用してRedhat7LinuxにDockerエンジンをインストールすることです。
要件
インターネット接続と、Redhat7Linuxへの特権アクセスが必要です。
難易度
簡単
規約
- # –指定されたLinuxコマンドは、rootユーザーとして直接、または
sudo
を使用して、root権限で実行する必要があります。 コマンド - $ –特定のLinuxコマンドを通常の非特権ユーザーとして実行する必要があります
手順
dockerのインストール
ネイティブのdockerスクリプトを使用したdockerのインストールは、1つのコマンドであり、簡単なプロセスです。以下のdockerインストールコマンドを実行する前に、curl
を確認してください。 パッケージがシステムにインストールされている:
# curl --version curl 7.29.0 (x86_64-redhat-linux-gnu)
準備ができたら、curl
を使用してdockerをインストールします ネイティブDockerインストールスクリプトをダウンロードして実行するコマンド:
# curl -sSL https://get.docker.com/ | sh + sh -c 'sleep 3; yum -y -q install docker-engine' warning: /var/cache/yum/x86_64/7Server/docker-main-repo/packages/docker-engine-1.12.3-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY Importing GPG key 0x2C52609D: Userid : "Docker Release Tool (releasedocker)" Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d From : https://yum.dockerproject.org/gpg If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like: sudo usermod -aG docker your-user Remember that you will have to log out and back in for this to take effect!
dockerを有効にして起動する
再起動後にDockerをRedhat7Linuxで起動できるようにするには、次のlinuxコマンドを実行します。
# systemctl enable docker Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
Dockerデーモンを起動するには:
# systemctl start docker
テスト
Dockerのインストールをテストするには、次のコマンドを実行します:
# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world c04b14da8d14: Pull complete Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly.
次のコマンドで新しいコンテナを一覧表示できます:
# docker ps -a