Cleanup / sync RHEL, CentOS, Fedora installation docs
| ... | ... |
@@ -16,114 +16,151 @@ Docker runs on CentOS 7.X. An installation on other binary compatible EL7 |
| 16 | 16 |
distributions such as Scientific Linux might succeed, but Docker does not test |
| 17 | 17 |
or support Docker on these distributions. |
| 18 | 18 |
|
| 19 |
-This page instructs you to install using Docker-managed release packages and |
|
| 20 |
-installation mechanisms. Using these packages ensures you get the latest release |
|
| 21 |
-of Docker. If you wish to install using CentOS-managed packages, consult your |
|
| 22 |
-CentOS documentation. |
|
| 19 |
+These instructions install Docker using release packages and installation |
|
| 20 |
+mechanisms managed by Docker, to be sure that you get the latest version |
|
| 21 |
+of Docker. If you wish to install using CentOS-managed packages, consult |
|
| 22 |
+your CentOS release documentation. |
|
| 23 | 23 |
|
| 24 | 24 |
## Prerequisites |
| 25 | 25 |
|
| 26 |
-Docker requires a 64-bit installation regardless of your CentOS version. Also, |
|
| 27 |
-your kernel must be 3.10 at minimum, which CentOS 7 runs. |
|
| 26 |
+Docker requires a 64-bit OS and version 3.10 or higher of the Linux kernel. |
|
| 28 | 27 |
|
| 29 | 28 |
To check your current kernel version, open a terminal and use `uname -r` to |
| 30 | 29 |
display your kernel version: |
| 31 | 30 |
|
| 32 |
- $ uname -r |
|
| 33 |
- 3.10.0-229.el7.x86_64 |
|
| 31 |
+```bash |
|
| 32 |
+$ uname -r |
|
| 33 |
+3.10.0-229.el7.x86_64 |
|
| 34 |
+``` |
|
| 34 | 35 |
|
| 35 |
-Finally, it is recommended that you fully update your system. Please keep in |
|
| 36 |
-mind that your system should be fully patched to fix any potential kernel bugs. |
|
| 36 |
+Finally, it is recommended that you fully update your system. Keep in mind |
|
| 37 |
+that your system should be fully patched to fix any potential kernel bugs. |
|
| 37 | 38 |
Any reported kernel bugs may have already been fixed on the latest kernel |
| 38 | 39 |
packages. |
| 39 | 40 |
|
| 40 |
-## Install |
|
| 41 |
+## Install Docker Engine |
|
| 41 | 42 |
|
| 42 |
-There are two ways to install Docker Engine. You can install using the `yum` |
|
| 43 |
-package manager. Or you can use `curl` with the `get.docker.com` site. This |
|
| 44 |
-second method runs an installation script which also installs via the `yum` |
|
| 45 |
-package manager. |
|
| 43 |
+There are two ways to install Docker Engine. You can [install using the `yum` |
|
| 44 |
+package manager](#install-with-yum). Or you can use `curl` with the [`get.docker.com` |
|
| 45 |
+site](#install-with-the-script). This second method runs an installation script |
|
| 46 |
+which also installs via the `yum` package manager. |
|
| 46 | 47 |
|
| 47 | 48 |
### Install with yum |
| 48 | 49 |
|
| 49 | 50 |
1. Log into your machine as a user with `sudo` or `root` privileges. |
| 50 | 51 |
|
| 51 |
-2. Make sure your existing yum packages are up-to-date. |
|
| 52 |
+2. Make sure your existing packages are up-to-date. |
|
| 52 | 53 |
|
| 53 |
- $ sudo yum update |
|
| 54 |
+ ```bash |
|
| 55 |
+ $ sudo yum update |
|
| 56 |
+ ``` |
|
| 54 | 57 |
|
| 55 |
-3. Add the yum repo. |
|
| 58 |
+3. Add the `yum` repo. |
|
| 56 | 59 |
|
| 57 |
- $ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' |
|
| 58 |
- [dockerrepo] |
|
| 59 |
- name=Docker Repository |
|
| 60 |
- baseurl=https://yum.dockerproject.org/repo/main/centos/7/ |
|
| 61 |
- enabled=1 |
|
| 62 |
- gpgcheck=1 |
|
| 63 |
- gpgkey=https://yum.dockerproject.org/gpg |
|
| 64 |
- EOF |
|
| 60 |
+ ```bash |
|
| 61 |
+ $ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' |
|
| 62 |
+ [dockerrepo] |
|
| 63 |
+ name=Docker Repository |
|
| 64 |
+ baseurl=https://yum.dockerproject.org/repo/main/centos/7/ |
|
| 65 |
+ enabled=1 |
|
| 66 |
+ gpgcheck=1 |
|
| 67 |
+ gpgkey=https://yum.dockerproject.org/gpg |
|
| 68 |
+ EOF |
|
| 69 |
+ ``` |
|
| 65 | 70 |
|
| 66 | 71 |
4. Install the Docker package. |
| 67 | 72 |
|
| 68 |
- $ sudo yum install docker-engine |
|
| 73 |
+ ```bash |
|
| 74 |
+ $ sudo yum install docker-engine |
|
| 75 |
+ ``` |
|
| 69 | 76 |
|
| 70 |
-5. Start the Docker daemon. |
|
| 77 |
+5. Enable the service. |
|
| 71 | 78 |
|
| 72 |
- $ sudo service docker start |
|
| 79 |
+ ```bash |
|
| 80 |
+ $ sudo systemctl enable docker.service |
|
| 81 |
+ ``` |
|
| 73 | 82 |
|
| 74 |
-6. Verify `docker` is installed correctly by running a test image in a container. |
|
| 83 |
+6. Start the Docker daemon. |
|
| 84 |
+ |
|
| 85 |
+ ```bash |
|
| 86 |
+ $ sudo systemctl start docker |
|
| 87 |
+ ``` |
|
| 88 |
+ |
|
| 89 |
+7. Verify `docker` is installed correctly by running a test image in a container. |
|
| 90 |
+ |
|
| 91 |
+ $ sudo docker run --rm hello-world |
|
| 75 | 92 |
|
| 76 |
- $ sudo docker run hello-world |
|
| 77 | 93 |
Unable to find image 'hello-world:latest' locally |
| 78 |
- latest: Pulling from hello-world |
|
| 79 |
- a8219747be10: Pull complete |
|
| 80 |
- 91c95931e552: Already exists |
|
| 81 |
- hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. |
|
| 82 |
- Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d |
|
| 83 |
- Status: Downloaded newer image for hello-world:latest |
|
| 84 |
- Hello from Docker. |
|
| 85 |
- This message shows that your installation appears to be working correctly. |
|
| 86 |
- |
|
| 87 |
- To generate this message, Docker took the following steps: |
|
| 88 |
- 1. The Docker client contacted the Docker daemon. |
|
| 89 |
- 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. |
|
| 90 |
- (Assuming it was not already locally available.) |
|
| 91 |
- 3. The Docker daemon created a new container from that image which runs the |
|
| 92 |
- executable that produces the output you are currently reading. |
|
| 93 |
- 4. The Docker daemon streamed that output to the Docker client, which sent it |
|
| 94 |
- to your terminal. |
|
| 95 |
- |
|
| 96 |
- To try something more ambitious, you can run an Ubuntu container with: |
|
| 97 |
- $ docker run -it ubuntu bash |
|
| 98 |
- |
|
| 99 |
- For more examples and ideas, visit: |
|
| 100 |
- http://docs.docker.com/userguide/ |
|
| 94 |
+ latest: Pulling from library/hello-world |
|
| 95 |
+ c04b14da8d14: Pull complete |
|
| 96 |
+ Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9 |
|
| 97 |
+ Status: Downloaded newer image for hello-world:latest |
|
| 101 | 98 |
|
| 102 |
-### Install with the script |
|
| 99 |
+ Hello from Docker! |
|
| 100 |
+ This message shows that your installation appears to be working correctly. |
|
| 101 |
+ |
|
| 102 |
+ To generate this message, Docker took the following steps: |
|
| 103 |
+ 1. The Docker client contacted the Docker daemon. |
|
| 104 |
+ 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. |
|
| 105 |
+ 3. The Docker daemon created a new container from that image which runs the |
|
| 106 |
+ executable that produces the output you are currently reading. |
|
| 107 |
+ 4. The Docker daemon streamed that output to the Docker client, which sent it |
|
| 108 |
+ to your terminal. |
|
| 109 |
+ |
|
| 110 |
+ To try something more ambitious, you can run an Ubuntu container with: |
|
| 111 |
+ $ docker run -it ubuntu bash |
|
| 103 | 112 |
|
| 113 |
+ Share images, automate workflows, and more with a free Docker Hub account: |
|
| 114 |
+ https://hub.docker.com |
|
| 115 |
+ |
|
| 116 |
+ For more examples and ideas, visit: |
|
| 117 |
+ https://docs.docker.com/engine/userguide/ |
|
| 118 |
+ |
|
| 119 |
+If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 120 |
+Docker runtime files, or make other customizations, read our Systemd article to |
|
| 121 |
+learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 122 |
+ |
|
| 123 |
+### Install with the script |
|
| 104 | 124 |
|
| 105 | 125 |
1. Log into your machine as a user with `sudo` or `root` privileges. |
| 106 | 126 |
|
| 107 |
-2. Make sure your existing yum packages are up-to-date. |
|
| 127 |
+2. Make sure your existing packages are up-to-date. |
|
| 108 | 128 |
|
| 109 |
- $ sudo yum update |
|
| 129 |
+ ```bash |
|
| 130 |
+ $ sudo yum update |
|
| 131 |
+ ``` |
|
| 110 | 132 |
|
| 111 | 133 |
3. Run the Docker installation script. |
| 112 | 134 |
|
| 113 |
- $ curl -fsSL https://get.docker.com/ | sh |
|
| 135 |
+ ```bash |
|
| 136 |
+ $ curl -fsSL https://get.docker.com/ | sh |
|
| 137 |
+ ``` |
|
| 114 | 138 |
|
| 115 |
- This script adds the `docker.repo` repository and installs Docker. |
|
| 139 |
+ This script adds the `docker.repo` repository and installs Docker. |
|
| 116 | 140 |
|
| 117 |
-4. Start the Docker daemon. |
|
| 141 |
+4. Enable the service. |
|
| 118 | 142 |
|
| 119 |
- $ sudo service docker start |
|
| 143 |
+ ```bash |
|
| 144 |
+ $ sudo systemctl enable docker.service |
|
| 145 |
+ ``` |
|
| 120 | 146 |
|
| 121 |
-5. Verify `docker` is installed correctly by running a test image in a container. |
|
| 147 |
+5. Start the Docker daemon. |
|
| 148 |
+ |
|
| 149 |
+ ```bash |
|
| 150 |
+ $ sudo systemctl start docker |
|
| 151 |
+ ``` |
|
| 152 |
+ |
|
| 153 |
+6. Verify `docker` is installed correctly by running a test image in a container. |
|
| 122 | 154 |
|
| 123 |
- $ sudo docker run hello-world |
|
| 155 |
+ ```bash |
|
| 156 |
+ $ sudo docker run hello-world |
|
| 157 |
+ ``` |
|
| 124 | 158 |
|
| 159 |
+If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 160 |
+Docker runtime files, or make other customizations, read our Systemd article to |
|
| 161 |
+learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 125 | 162 |
|
| 126 |
-## Create a docker group |
|
| 163 |
+## Create a docker group |
|
| 127 | 164 |
|
| 128 | 165 |
The `docker` daemon binds to a Unix socket instead of a TCP port. By default |
| 129 | 166 |
that Unix socket is owned by the user `root` and other users can access it with |
| ... | ... |
@@ -139,54 +176,63 @@ makes the ownership of the Unix socket read/writable by the `docker` group. |
| 139 | 139 |
|
| 140 | 140 |
To create the `docker` group and add your user: |
| 141 | 141 |
|
| 142 |
-1. Log into Centos as a user with `sudo` privileges. |
|
| 142 |
+1. Log into your machine as a user with `sudo` or `root` privileges. |
|
| 143 | 143 |
|
| 144 | 144 |
2. Create the `docker` group. |
| 145 | 145 |
|
| 146 |
- `sudo groupadd docker` |
|
| 146 |
+ ```bash |
|
| 147 |
+ $ sudo groupadd docker |
|
| 148 |
+ ``` |
|
| 147 | 149 |
|
| 148 | 150 |
3. Add your user to `docker` group. |
| 149 | 151 |
|
| 150 |
- `sudo usermod -aG docker your_username` |
|
| 152 |
+ ```bash |
|
| 153 |
+ $ sudo usermod -aG docker your_username` |
|
| 154 |
+ ``` |
|
| 151 | 155 |
|
| 152 | 156 |
4. Log out and log back in. |
| 153 | 157 |
|
| 154 | 158 |
This ensures your user is running with the correct permissions. |
| 155 | 159 |
|
| 156 |
-5. Verify your work by running `docker` without `sudo`. |
|
| 160 |
+5. Verify that your user is in the docker group by running `docker` without `sudo`. |
|
| 157 | 161 |
|
| 158 |
- $ docker run hello-world |
|
| 162 |
+ ```bash |
|
| 163 |
+ $ docker run hello-world |
|
| 164 |
+ ``` |
|
| 159 | 165 |
|
| 160 | 166 |
## Start the docker daemon at boot |
| 161 | 167 |
|
| 162 |
-To ensure Docker starts when you boot your system, do the following: |
|
| 163 |
- |
|
| 164 |
- $ sudo chkconfig docker on |
|
| 165 |
- |
|
| 166 |
-If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 167 |
-Docker runtime files, or make other customizations, read our Systemd article to |
|
| 168 |
-learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 168 |
+Configure the Docker daemon to start automatically when the host starts: |
|
| 169 | 169 |
|
| 170 |
+```bash |
|
| 171 |
+$ sudo systemctl enable docker |
|
| 172 |
+``` |
|
| 170 | 173 |
|
| 171 | 174 |
## Uninstall |
| 172 | 175 |
|
| 173 |
-You can uninstall the Docker software with `yum`. |
|
| 176 |
+You can uninstall the Docker software with `yum`. |
|
| 177 |
+ |
|
| 178 |
+1. List the installed Docker packages. |
|
| 174 | 179 |
|
| 175 |
-1. List the package you have installed. |
|
| 180 |
+ ```bash |
|
| 181 |
+ $ yum list installed | grep docker |
|
| 176 | 182 |
|
| 177 |
- $ yum list installed | grep docker |
|
| 178 |
- yum list installed | grep docker |
|
| 179 |
- docker-engine.x86_64 1.7.1-1.el7 @/docker-engine-1.7.1-1.el7.x86_64.rpm |
|
| 183 |
+ docker-engine.x86_64 1.7.1-0.1.el7@/docker-engine-1.7.1-0.1.el7.x86_64 |
|
| 184 |
+ ``` |
|
| 180 | 185 |
|
| 181 | 186 |
2. Remove the package. |
| 182 | 187 |
|
| 183 |
- $ sudo yum -y remove docker-engine.x86_64 |
|
| 188 |
+ ```bash |
|
| 189 |
+ $ sudo yum -y remove docker-engine.x86_64 |
|
| 190 |
+ ``` |
|
| 184 | 191 |
|
| 185 | 192 |
This command does not remove images, containers, volumes, or user-created |
| 186 | 193 |
configuration files on your host. |
| 187 | 194 |
|
| 188 | 195 |
3. To delete all images, containers, and volumes, run the following command: |
| 189 | 196 |
|
| 190 |
- $ rm -rf /var/lib/docker |
|
| 197 |
+ ```bash |
|
| 198 |
+ $ rm -rf /var/lib/docker |
|
| 199 |
+ ``` |
|
| 191 | 200 |
|
| 192 | 201 |
4. Locate and delete any user-created configuration files. |
| ... | ... |
@@ -12,80 +12,94 @@ weight=-3 |
| 12 | 12 |
|
| 13 | 13 |
# Fedora |
| 14 | 14 |
|
| 15 |
-Docker is supported on Fedora version 22, 23, and 24. This page instructs you to install |
|
| 16 |
-using Docker-managed release packages and installation mechanisms. Using these |
|
| 17 |
-packages ensures you get the latest release of Docker. If you wish to install |
|
| 18 |
-using Fedora-managed packages, consult your Fedora release documentation for |
|
| 19 |
-information on Fedora's Docker support. |
|
| 15 |
+Docker is supported on Fedora version 22, 23, and 24. These instructions install |
|
| 16 |
+Docker using release packages and installation mechanisms managed by Docker, to |
|
| 17 |
+be sure that you get the latest version of Docker. If you wish to install using |
|
| 18 |
+Fedora-managed packages, consult your Fedora release documentation. |
|
| 20 | 19 |
|
| 21 | 20 |
## Prerequisites |
| 22 | 21 |
|
| 23 |
-Docker requires a 64-bit installation regardless of your Fedora version. Also, your kernel must be 3.10 at minimum. To check your current kernel |
|
| 24 |
-version, open a terminal and use `uname -r` to display your kernel version: |
|
| 22 |
+Docker requires a 64-bit OS and version 3.10 or higher of the Linux kernel. |
|
| 25 | 23 |
|
| 26 |
- $ uname -r |
|
| 27 |
- 3.19.5-100.fc21.x86_64 |
|
| 24 |
+To check your current kernel version, open a terminal and use `uname -r` to |
|
| 25 |
+display your kernel version: |
|
| 28 | 26 |
|
| 29 |
-If your kernel is at an older version, you must update it. |
|
| 27 |
+```bash |
|
| 28 |
+$ uname -r |
|
| 29 |
+3.19.5-100.fc21.x86_64 |
|
| 30 |
+``` |
|
| 30 | 31 |
|
| 31 |
-Finally, is it recommended that you fully update your system. Please keep in |
|
| 32 |
-mind that your system should be fully patched to fix any potential kernel bugs. Any |
|
| 33 |
-reported kernel bugs may have already been fixed on the latest kernel packages |
|
| 32 |
+If your kernel is at an older version, you must update it. |
|
| 34 | 33 |
|
| 34 |
+Finally, it is recommended that you fully update your system. Keep in mind |
|
| 35 |
+that your system should be fully patched to fix any potential kernel bugs. |
|
| 36 |
+Any reported kernel bugs may have already been fixed on the latest kernel |
|
| 37 |
+packages. |
|
| 35 | 38 |
|
| 36 |
-## Install |
|
| 39 |
+## Install Docker Engine |
|
| 37 | 40 |
|
| 38 |
-There are two ways to install Docker Engine. You can install with the `dnf` package manager. Or you can use `curl` with the `get.docker.com` site. This second method runs an installation script which also installs via the `dnf` package manager. |
|
| 41 |
+There are two ways to install Docker Engine. You can [install using the `dnf` |
|
| 42 |
+package manager](#install-with-dnf). Or you can use `curl` [with the `get.docker.com` |
|
| 43 |
+site](#install-with-the-script). This second method runs an installation script |
|
| 44 |
+which also installs via the `dnf` package manager. |
|
| 39 | 45 |
|
| 40 | 46 |
### Install with DNF |
| 41 | 47 |
|
| 42 | 48 |
1. Log into your machine as a user with `sudo` or `root` privileges. |
| 43 | 49 |
|
| 44 |
-2. Make sure your existing dnf packages are up-to-date. |
|
| 50 |
+2. Make sure your existing packages are up-to-date. |
|
| 45 | 51 |
|
| 46 |
- $ sudo dnf update |
|
| 52 |
+ ```bash |
|
| 53 |
+ $ sudo dnf update |
|
| 54 |
+ ``` |
|
| 47 | 55 |
|
| 48 |
-3. Add the yum repo yourself. |
|
| 56 |
+3. Add the `yum` repo. |
|
| 49 | 57 |
|
| 50 |
- $ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' |
|
| 51 |
- [dockerrepo] |
|
| 52 |
- name=Docker Repository |
|
| 53 |
- baseurl=https://yum.dockerproject.org/repo/main/fedora/$releasever/ |
|
| 54 |
- enabled=1 |
|
| 55 |
- gpgcheck=1 |
|
| 56 |
- gpgkey=https://yum.dockerproject.org/gpg |
|
| 57 |
- EOF |
|
| 58 |
+ ```bash |
|
| 59 |
+ $ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' |
|
| 60 |
+ [dockerrepo] |
|
| 61 |
+ name=Docker Repository |
|
| 62 |
+ baseurl=https://yum.dockerproject.org/repo/main/fedora/$releasever/ |
|
| 63 |
+ enabled=1 |
|
| 64 |
+ gpgcheck=1 |
|
| 65 |
+ gpgkey=https://yum.dockerproject.org/gpg |
|
| 66 |
+ EOF |
|
| 67 |
+ ``` |
|
| 58 | 68 |
|
| 59 | 69 |
4. Install the Docker package. |
| 60 | 70 |
|
| 61 |
- $ sudo dnf install docker-engine |
|
| 71 |
+ ```bash |
|
| 72 |
+ $ sudo dnf install docker-engine |
|
| 73 |
+ ``` |
|
| 62 | 74 |
|
| 63 | 75 |
5. Enable the service. |
| 64 | 76 |
|
| 65 |
- $ sudo systemctl enable docker.service |
|
| 77 |
+ ```bash |
|
| 78 |
+ $ sudo systemctl enable docker.service |
|
| 79 |
+ ``` |
|
| 66 | 80 |
|
| 67 | 81 |
6. Start the Docker daemon. |
| 68 | 82 |
|
| 69 |
- $ sudo systemctl start docker |
|
| 83 |
+ ```bash |
|
| 84 |
+ $ sudo systemctl start docker |
|
| 85 |
+ ``` |
|
| 70 | 86 |
|
| 71 | 87 |
7. Verify `docker` is installed correctly by running a test image in a container. |
| 72 | 88 |
|
| 89 |
+ $ sudo docker run --rm hello-world |
|
| 73 | 90 |
|
| 74 |
- $ sudo docker run hello-world |
|
| 75 | 91 |
Unable to find image 'hello-world:latest' locally |
| 76 |
- latest: Pulling from hello-world |
|
| 77 |
- a8219747be10: Pull complete |
|
| 78 |
- 91c95931e552: Already exists |
|
| 79 |
- hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. |
|
| 80 |
- Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d |
|
| 92 |
+ latest: Pulling from library/hello-world |
|
| 93 |
+ c04b14da8d14: Pull complete |
|
| 94 |
+ Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9 |
|
| 81 | 95 |
Status: Downloaded newer image for hello-world:latest |
| 82 |
- Hello from Docker. |
|
| 96 |
+ |
|
| 97 |
+ Hello from Docker! |
|
| 83 | 98 |
This message shows that your installation appears to be working correctly. |
| 84 | 99 |
|
| 85 | 100 |
To generate this message, Docker took the following steps: |
| 86 | 101 |
1. The Docker client contacted the Docker daemon. |
| 87 | 102 |
2. The Docker daemon pulled the "hello-world" image from the Docker Hub. |
| 88 |
- (Assuming it was not already locally available.) |
|
| 89 | 103 |
3. The Docker daemon created a new container from that image which runs the |
| 90 | 104 |
executable that produces the output you are currently reading. |
| 91 | 105 |
4. The Docker daemon streamed that output to the Docker client, which sent it |
| ... | ... |
@@ -94,36 +108,57 @@ There are two ways to install Docker Engine. You can install with the `dnf` pac |
| 94 | 94 |
To try something more ambitious, you can run an Ubuntu container with: |
| 95 | 95 |
$ docker run -it ubuntu bash |
| 96 | 96 |
|
| 97 |
+ Share images, automate workflows, and more with a free Docker Hub account: |
|
| 98 |
+ https://hub.docker.com |
|
| 99 |
+ |
|
| 97 | 100 |
For more examples and ideas, visit: |
| 98 |
- http://docs.docker.com/userguide/ |
|
| 101 |
+ https://docs.docker.com/engine/userguide/ |
|
| 99 | 102 |
|
| 103 |
+If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 104 |
+Docker runtime files, or make other customizations, read our Systemd article to |
|
| 105 |
+learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 100 | 106 |
|
| 101 | 107 |
### Install with the script |
| 102 | 108 |
|
| 109 |
+You use the same installation procedure for all versions of Fedora. |
|
| 103 | 110 |
|
| 104 | 111 |
1. Log into your machine as a user with `sudo` or `root` privileges. |
| 105 | 112 |
|
| 106 |
-2. Make sure your existing dnf packages are up-to-date. |
|
| 113 |
+2. Make sure your existing packages are up-to-date. |
|
| 107 | 114 |
|
| 108 |
- $ sudo dnf update |
|
| 115 |
+ ```bash |
|
| 116 |
+ $ sudo dnf update |
|
| 117 |
+ ``` |
|
| 109 | 118 |
|
| 110 | 119 |
3. Run the Docker installation script. |
| 111 | 120 |
|
| 112 |
- $ curl -fsSL https://get.docker.com/ | sh |
|
| 121 |
+ ```bash |
|
| 122 |
+ $ curl -fsSL https://get.docker.com/ | sh |
|
| 123 |
+ ``` |
|
| 113 | 124 |
|
| 114 |
- This script adds the `docker.repo` repository and installs Docker. |
|
| 125 |
+ This script adds the `docker.repo` repository and installs Docker. |
|
| 115 | 126 |
|
| 116 | 127 |
4. Enable the service. |
| 117 | 128 |
|
| 118 |
- $ sudo systemctl enable docker.service |
|
| 129 |
+ ```bash |
|
| 130 |
+ $ sudo systemctl enable docker.service |
|
| 131 |
+ ``` |
|
| 119 | 132 |
|
| 120 | 133 |
5. Start the Docker daemon. |
| 121 | 134 |
|
| 122 |
- $ sudo systemctl start docker |
|
| 135 |
+ ```bash |
|
| 136 |
+ $ sudo systemctl start docker |
|
| 137 |
+ ``` |
|
| 123 | 138 |
|
| 124 | 139 |
6. Verify `docker` is installed correctly by running a test image in a container. |
| 125 | 140 |
|
| 126 |
- $ sudo docker run hello-world |
|
| 141 |
+ ```bash |
|
| 142 |
+ $ sudo docker run hello-world |
|
| 143 |
+ ``` |
|
| 144 |
+ |
|
| 145 |
+If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 146 |
+Docker runtime files, or make other customizations, read our Systemd article to |
|
| 147 |
+learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 127 | 148 |
|
| 128 | 149 |
## Create a docker group |
| 129 | 150 |
|
| ... | ... |
@@ -141,27 +176,37 @@ makes the ownership of the Unix socket read/writable by the `docker` group. |
| 141 | 141 |
|
| 142 | 142 |
To create the `docker` group and add your user: |
| 143 | 143 |
|
| 144 |
-1. Log into your system as a user with `sudo` privileges. |
|
| 144 |
+1. Log into your machine as a user with `sudo` or `root` privileges. |
|
| 145 | 145 |
|
| 146 | 146 |
2. Create the `docker` group. |
| 147 | 147 |
|
| 148 |
- `sudo groupadd docker` |
|
| 148 |
+ ```bash |
|
| 149 |
+ $ sudo groupadd docker |
|
| 150 |
+ ``` |
|
| 149 | 151 |
|
| 150 | 152 |
3. Add your user to `docker` group. |
| 151 | 153 |
|
| 152 |
- `sudo usermod -aG docker your_username` |
|
| 154 |
+ ```bash |
|
| 155 |
+ $ sudo usermod -aG docker your_username` |
|
| 156 |
+ ``` |
|
| 153 | 157 |
|
| 154 | 158 |
4. Log out and log back in. |
| 155 | 159 |
|
| 156 | 160 |
This ensures your user is running with the correct permissions. |
| 157 | 161 |
|
| 158 |
-5. Verify your work by running `docker` without `sudo`. |
|
| 162 |
+5. Verify that your user is in the docker group by running `docker` without `sudo`. |
|
| 159 | 163 |
|
| 160 |
- $ docker run hello-world |
|
| 164 |
+ ```bash |
|
| 165 |
+ $ docker run hello-world |
|
| 166 |
+ ``` |
|
| 161 | 167 |
|
| 162 |
-If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 163 |
-Docker runtime files, or make other customizations, read our Systemd article to |
|
| 164 |
-learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 168 |
+## Start the docker daemon at boot |
|
| 169 |
+ |
|
| 170 |
+Configure the Docker daemon to start automatically when the host starts: |
|
| 171 |
+ |
|
| 172 |
+```bash |
|
| 173 |
+$ sudo systemctl enable docker |
|
| 174 |
+``` |
|
| 165 | 175 |
|
| 166 | 176 |
## Running Docker with a manually-defined network |
| 167 | 177 |
|
| ... | ... |
@@ -186,20 +231,27 @@ This configuration allows IP forwarding from the container as expected. |
| 186 | 186 |
|
| 187 | 187 |
You can uninstall the Docker software with `dnf`. |
| 188 | 188 |
|
| 189 |
-1. List the package you have installed. |
|
| 189 |
+1. List the installed Docker packages. |
|
| 190 |
+ |
|
| 191 |
+ ```bash |
|
| 192 |
+ $ dnf list installed | grep docker |
|
| 190 | 193 |
|
| 191 |
- $ dnf list installed | grep docker |
|
| 192 |
- docker-engine.x86_64 1.7.1-0.1.fc21 @/docker-engine-1.7.1-0.1.fc21.el7.x86_64 |
|
| 194 |
+ docker-engine.x86_64 1.7.1-0.1.fc21 @/docker-engine-1.7.1-0.1.fc21.el7.x86_64 |
|
| 195 |
+ ``` |
|
| 193 | 196 |
|
| 194 | 197 |
2. Remove the package. |
| 195 | 198 |
|
| 196 |
- $ sudo dnf -y remove docker-engine.x86_64 |
|
| 199 |
+ ```bash |
|
| 200 |
+ $ sudo dnf -y remove docker-engine.x86_64 |
|
| 201 |
+ ``` |
|
| 197 | 202 |
|
| 198 | 203 |
This command does not remove images, containers, volumes, or user-created |
| 199 | 204 |
configuration files on your host. |
| 200 | 205 |
|
| 201 | 206 |
3. To delete all images, containers, and volumes, run the following command: |
| 202 | 207 |
|
| 203 |
- $ rm -rf /var/lib/docker |
|
| 208 |
+ ```bash |
|
| 209 |
+ $ rm -rf /var/lib/docker |
|
| 210 |
+ ``` |
|
| 204 | 211 |
|
| 205 | 212 |
4. Locate and delete any user-created configuration files. |
| ... | ... |
@@ -12,110 +12,151 @@ weight = -5 |
| 12 | 12 |
|
| 13 | 13 |
# Red Hat Enterprise Linux |
| 14 | 14 |
|
| 15 |
-Docker is supported on Red Hat Enterprise Linux 7. This page instructs you to |
|
| 16 |
-install using Docker-managed release packages and installation mechanisms. Using |
|
| 17 |
-these packages ensures you get the latest release of Docker. If you wish to |
|
| 18 |
-install using Red Hat-managed packages, consult your Red Hat release |
|
| 19 |
-documentation for information on Red Hat's Docker support. |
|
| 15 |
+Docker is supported on Red Hat Enterprise Linux 7. These instructions install |
|
| 16 |
+Docker using release packages and installation mechanisms managed by Docker, |
|
| 17 |
+to be sure that you get the latest version of Docker. If you wish to install |
|
| 18 |
+using Red Hat-managed packages, consult your Red Hat release documentation. |
|
| 20 | 19 |
|
| 21 | 20 |
## Prerequisites |
| 22 | 21 |
|
| 23 |
-Docker requires a 64-bit installation regardless of your Red Hat version. Docker |
|
| 24 |
-requires that your kernel must be 3.10 at minimum, which Red Hat 7 runs. |
|
| 22 |
+Docker requires a 64-bit OS and version 3.10 or higher of the Linux kernel. |
|
| 25 | 23 |
|
| 26 | 24 |
To check your current kernel version, open a terminal and use `uname -r` to |
| 27 | 25 |
display your kernel version: |
| 28 | 26 |
|
| 29 |
- $ uname -r |
|
| 30 |
- 3.10.0-229.el7.x86_64 |
|
| 27 |
+```bash |
|
| 28 |
+$ uname -r |
|
| 29 |
+3.10.0-229.el7.x86_64 |
|
| 30 |
+``` |
|
| 31 | 31 |
|
| 32 |
-Finally, is it recommended that you fully update your system. Please keep in |
|
| 33 |
-mind that your system should be fully patched to fix any potential kernel bugs. |
|
| 32 |
+Finally, it is recommended that you fully update your system. Keep in mind |
|
| 33 |
+that your system should be fully patched to fix any potential kernel bugs. |
|
| 34 | 34 |
Any reported kernel bugs may have already been fixed on the latest kernel |
| 35 | 35 |
packages. |
| 36 | 36 |
|
| 37 | 37 |
## Install Docker Engine |
| 38 | 38 |
|
| 39 |
-There are two ways to install Docker Engine. You can install with the `yum` package manager directly yourself. Or you can use `curl` with the `get.docker.com` site. This second method runs an installation script which installs via the `yum` package manager. |
|
| 39 |
+There are two ways to install Docker Engine. You can [install using the `yum` |
|
| 40 |
+package manager](#install-with-yum). Or you can use `curl` with the [`get.docker.com` |
|
| 41 |
+site](#install-with-the-script). This second method runs an installation script |
|
| 42 |
+which also installs via the `yum` package manager. |
|
| 40 | 43 |
|
| 41 | 44 |
### Install with yum |
| 42 | 45 |
|
| 43 | 46 |
1. Log into your machine as a user with `sudo` or `root` privileges. |
| 44 | 47 |
|
| 45 |
-2. Make sure your existing yum packages are up-to-date. |
|
| 48 |
+2. Make sure your existing packages are up-to-date. |
|
| 46 | 49 |
|
| 47 |
- $ sudo yum update |
|
| 50 |
+ ```bash |
|
| 51 |
+ $ sudo yum update |
|
| 52 |
+ ``` |
|
| 48 | 53 |
|
| 49 |
-3. Add the yum repo yourself. |
|
| 54 |
+3. Add the `yum` repo. |
|
| 50 | 55 |
|
| 51 |
- $ sudo tee /etc/yum.repos.d/docker.repo <<-EOF |
|
| 52 |
- [dockerrepo] |
|
| 53 |
- name=Docker Repository |
|
| 54 |
- baseurl=https://yum.dockerproject.org/repo/main/centos/7 |
|
| 55 |
- enabled=1 |
|
| 56 |
- gpgcheck=1 |
|
| 57 |
- gpgkey=https://yum.dockerproject.org/gpg |
|
| 58 |
- EOF |
|
| 56 |
+ ```bash |
|
| 57 |
+ $ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' |
|
| 58 |
+ [dockerrepo] |
|
| 59 |
+ name=Docker Repository |
|
| 60 |
+ baseurl=https://yum.dockerproject.org/repo/main/centos/7/ |
|
| 61 |
+ enabled=1 |
|
| 62 |
+ gpgcheck=1 |
|
| 63 |
+ gpgkey=https://yum.dockerproject.org/gpg |
|
| 64 |
+ EOF |
|
| 65 |
+ ``` |
|
| 59 | 66 |
|
| 60 | 67 |
4. Install the Docker package. |
| 61 | 68 |
|
| 62 |
- $ sudo yum install docker-engine |
|
| 69 |
+ ```bash |
|
| 70 |
+ $ sudo yum install docker-engine |
|
| 71 |
+ ``` |
|
| 63 | 72 |
|
| 64 |
-5. Start the Docker daemon. |
|
| 73 |
+5. Enable the service. |
|
| 65 | 74 |
|
| 66 |
- $ sudo service docker start |
|
| 75 |
+ ```bash |
|
| 76 |
+ $ sudo systemctl enable docker.service |
|
| 77 |
+ ``` |
|
| 67 | 78 |
|
| 68 |
-6. Verify `docker` is installed correctly by running a test image in a container. |
|
| 79 |
+6. Start the Docker daemon. |
|
| 80 |
+ |
|
| 81 |
+ ```bash |
|
| 82 |
+ $ sudo systemctl start docker |
|
| 83 |
+ ``` |
|
| 84 |
+ |
|
| 85 |
+7. Verify `docker` is installed correctly by running a test image in a container. |
|
| 86 |
+ |
|
| 87 |
+ $ sudo docker run --rm hello-world |
|
| 69 | 88 |
|
| 70 |
- $ sudo docker run hello-world |
|
| 71 | 89 |
Unable to find image 'hello-world:latest' locally |
| 72 |
- latest: Pulling from hello-world |
|
| 73 |
- a8219747be10: Pull complete |
|
| 74 |
- 91c95931e552: Already exists |
|
| 75 |
- hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. |
|
| 76 |
- Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d |
|
| 77 |
- Status: Downloaded newer image for hello-world:latest |
|
| 78 |
- Hello from Docker. |
|
| 79 |
- This message shows that your installation appears to be working correctly. |
|
| 80 |
- |
|
| 81 |
- To generate this message, Docker took the following steps: |
|
| 82 |
- 1. The Docker client contacted the Docker daemon. |
|
| 83 |
- 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. |
|
| 84 |
- (Assuming it was not already locally available.) |
|
| 85 |
- 3. The Docker daemon created a new container from that image which runs the |
|
| 86 |
- executable that produces the output you are currently reading. |
|
| 87 |
- 4. The Docker daemon streamed that output to the Docker client, which sent it |
|
| 88 |
- to your terminal. |
|
| 89 |
- |
|
| 90 |
- To try something more ambitious, you can run an Ubuntu container with: |
|
| 91 |
- $ docker run -it ubuntu bash |
|
| 92 |
- |
|
| 93 |
- For more examples and ideas, visit: |
|
| 94 |
- http://docs.docker.com/userguide/ |
|
| 90 |
+ latest: Pulling from library/hello-world |
|
| 91 |
+ c04b14da8d14: Pull complete |
|
| 92 |
+ Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9 |
|
| 93 |
+ Status: Downloaded newer image for hello-world:latest |
|
| 95 | 94 |
|
| 96 |
-### Install with the script |
|
| 95 |
+ Hello from Docker! |
|
| 96 |
+ This message shows that your installation appears to be working correctly. |
|
| 97 |
+ |
|
| 98 |
+ To generate this message, Docker took the following steps: |
|
| 99 |
+ 1. The Docker client contacted the Docker daemon. |
|
| 100 |
+ 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. |
|
| 101 |
+ 3. The Docker daemon created a new container from that image which runs the |
|
| 102 |
+ executable that produces the output you are currently reading. |
|
| 103 |
+ 4. The Docker daemon streamed that output to the Docker client, which sent it |
|
| 104 |
+ to your terminal. |
|
| 105 |
+ |
|
| 106 |
+ To try something more ambitious, you can run an Ubuntu container with: |
|
| 107 |
+ $ docker run -it ubuntu bash |
|
| 97 | 108 |
|
| 98 |
-You use the same installation procedure for all versions of CentOS. |
|
| 109 |
+ Share images, automate workflows, and more with a free Docker Hub account: |
|
| 110 |
+ https://hub.docker.com |
|
| 111 |
+ |
|
| 112 |
+ For more examples and ideas, visit: |
|
| 113 |
+ https://docs.docker.com/engine/userguide/ |
|
| 114 |
+ |
|
| 115 |
+If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 116 |
+Docker runtime files, or make other customizations, read our Systemd article to |
|
| 117 |
+learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 118 |
+ |
|
| 119 |
+### Install with the script |
|
| 99 | 120 |
|
| 100 | 121 |
1. Log into your machine as a user with `sudo` or `root` privileges. |
| 101 | 122 |
|
| 102 |
-2. Make sure your existing yum packages are up-to-date. |
|
| 123 |
+2. Make sure your existing packages are up-to-date. |
|
| 103 | 124 |
|
| 104 |
- $ sudo yum update |
|
| 125 |
+ ```bash |
|
| 126 |
+ $ sudo yum update |
|
| 127 |
+ ``` |
|
| 105 | 128 |
|
| 106 | 129 |
3. Run the Docker installation script. |
| 107 | 130 |
|
| 108 |
- $ curl -fsSL https://get.docker.com/ | sh |
|
| 131 |
+ ```bash |
|
| 132 |
+ $ curl -fsSL https://get.docker.com/ | sh |
|
| 133 |
+ ``` |
|
| 109 | 134 |
|
| 110 |
-4. Start the Docker daemon. |
|
| 135 |
+ This script adds the `docker.repo` repository and installs Docker. |
|
| 111 | 136 |
|
| 112 |
- $ sudo service docker start |
|
| 137 |
+4. Enable the service. |
|
| 113 | 138 |
|
| 114 |
-5. Verify `docker` is installed correctly by running a test image in a container. |
|
| 139 |
+ ```bash |
|
| 140 |
+ $ sudo systemctl enable docker.service |
|
| 141 |
+ ``` |
|
| 115 | 142 |
|
| 116 |
- $ sudo docker run hello-world |
|
| 143 |
+5. Start the Docker daemon. |
|
| 144 |
+ |
|
| 145 |
+ ```bash |
|
| 146 |
+ $ sudo systemctl start docker |
|
| 147 |
+ ``` |
|
| 148 |
+ |
|
| 149 |
+6. Verify `docker` is installed correctly by running a test image in a container. |
|
| 117 | 150 |
|
| 118 |
-## Create a docker group |
|
| 151 |
+ ```bash |
|
| 152 |
+ $ sudo docker run hello-world |
|
| 153 |
+ ``` |
|
| 154 |
+ |
|
| 155 |
+If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 156 |
+Docker runtime files, or make other customizations, read our Systemd article to |
|
| 157 |
+learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 158 |
+ |
|
| 159 |
+## Create a docker group |
|
| 119 | 160 |
|
| 120 | 161 |
The `docker` daemon binds to a Unix socket instead of a TCP port. By default |
| 121 | 162 |
that Unix socket is owned by the user `root` and other users can access it with |
| ... | ... |
@@ -135,50 +176,59 @@ To create the `docker` group and add your user: |
| 135 | 135 |
|
| 136 | 136 |
2. Create the `docker` group. |
| 137 | 137 |
|
| 138 |
- `sudo groupadd docker` |
|
| 138 |
+ ```bash |
|
| 139 |
+ $ sudo groupadd docker |
|
| 140 |
+ ``` |
|
| 139 | 141 |
|
| 140 | 142 |
3. Add your user to `docker` group. |
| 141 | 143 |
|
| 142 |
- `sudo usermod -aG docker your_username` |
|
| 144 |
+ ```bash |
|
| 145 |
+ $ sudo usermod -aG docker your_username` |
|
| 146 |
+ ``` |
|
| 143 | 147 |
|
| 144 | 148 |
4. Log out and log back in. |
| 145 | 149 |
|
| 146 | 150 |
This ensures your user is running with the correct permissions. |
| 147 | 151 |
|
| 148 |
-5. Verify your work by running `docker` without `sudo`. |
|
| 152 |
+5. Verify that your user is in the docker group by running `docker` without `sudo`. |
|
| 149 | 153 |
|
| 150 |
- $ docker run hello-world |
|
| 154 |
+ ```bash |
|
| 155 |
+ $ docker run hello-world |
|
| 156 |
+ ``` |
|
| 151 | 157 |
|
| 152 | 158 |
## Start the docker daemon at boot |
| 153 | 159 |
|
| 154 |
-To ensure Docker starts when you boot your system, do the following: |
|
| 155 |
- |
|
| 156 |
- $ sudo chkconfig docker on |
|
| 157 |
- |
|
| 158 |
-If you need to add an HTTP Proxy, set a different directory or partition for the |
|
| 159 |
-Docker runtime files, or make other customizations, read our Systemd article to |
|
| 160 |
-learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). |
|
| 160 |
+Configure the Docker daemon to start automatically when the host starts: |
|
| 161 | 161 |
|
| 162 |
+```bash |
|
| 163 |
+$ sudo systemctl enable docker |
|
| 164 |
+``` |
|
| 162 | 165 |
|
| 163 | 166 |
## Uninstall |
| 164 | 167 |
|
| 165 |
-You can uninstall the Docker software with `yum`. |
|
| 168 |
+You can uninstall the Docker software with `yum`. |
|
| 169 |
+ |
|
| 170 |
+1. List the installed Docker packages. |
|
| 166 | 171 |
|
| 167 |
-1. List the package you have installed. |
|
| 172 |
+ ```bash |
|
| 173 |
+ $ yum list installed | grep docker |
|
| 168 | 174 |
|
| 169 |
- $ yum list installed | grep docker |
|
| 170 |
- yum list installed | grep docker |
|
| 171 |
- docker-engine.x86_64 1.7.1-0.1.el7@/docker-engine-1.7.1-0.1.el7.x86_64 |
|
| 175 |
+ docker-engine.x86_64 1.7.1-0.1.el7@/docker-engine-1.7.1-0.1.el7.x86_64 |
|
| 176 |
+ ``` |
|
| 172 | 177 |
|
| 173 | 178 |
2. Remove the package. |
| 174 | 179 |
|
| 175 |
- $ sudo yum -y remove docker-engine.x86_64 |
|
| 180 |
+ ```bash |
|
| 181 |
+ $ sudo yum -y remove docker-engine.x86_64 |
|
| 182 |
+ ``` |
|
| 176 | 183 |
|
| 177 |
- This command does not remove images, containers, volumes, or user created |
|
| 184 |
+ This command does not remove images, containers, volumes, or user-created |
|
| 178 | 185 |
configuration files on your host. |
| 179 | 186 |
|
| 180 |
-3. To delete all images, containers, and volumes run the following command: |
|
| 187 |
+3. To delete all images, containers, and volumes, run the following command: |
|
| 181 | 188 |
|
| 182 |
- $ rm -rf /var/lib/docker |
|
| 189 |
+ ```bash |
|
| 190 |
+ $ rm -rf /var/lib/docker |
|
| 191 |
+ ``` |
|
| 183 | 192 |
|
| 184 | 193 |
4. Locate and delete any user-created configuration files. |