官术网_书友最值得收藏!

Installing on Linux

There are a lot of various Linux distributions out there and the installation process can be a little bit different for each Linux distribution. I'm going to install Docker on the latest, 16.04 Ubuntu desktop:

  1. First, we need to allow the apt package manager to use a repository over the HTTPS protocol. Execute from the shell:
$ sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl software-properties-common
  1. The next thing we are going to do is add Docker's apt repository gpg key to our apt sources list:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
  1. A simple OK will be the response if succeeded. Use the following command to set up the stable repository:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. Next, we need to update the apt packages index:
$ sudo apt-get update  
  1. Now we need to make sure the apt installer will use the official Docker repository instead of the default Ubuntu repository (which may contain the older version of Docker):
$ apt-cache policy docker-ce  
  1. Use this command to install the latest version of Docker:
$ sudo apt-get install -y docker-ce
  1. The apt package manager will download a lot of packages; those will be the needed dependencies and the docker-engine itself:

  1. That's it, you should be all set. Let's verify if Docker works on our Linux box:
$sudo docker run milkyway/java-hello-world  
  1. As you can see, the Docker engine will pull the milkyway/java-hello-world image with all its layers from the Docker Hub and respond with a greeting:

But do we need to run Docker commands with sudo? The reason for that is the Docker daemon always runs as the root user, and since Docker version 0.5.2, the Docker daemon binds to a Unix socket instead of a TCP port. By default, that Unix socket is owned by the user root, and so, by default, you can access it with sudo. Let's fix it to be able to run the Docker command as a normal user:

  1. First, add the Docker group if it doesn't already exist:
$ sudo groupadd docker
  1. Then, add your own user to the Docker group. Change the username to match your preferred user:
$ sudo gpasswd -a jarek docker  
  1. Restart the Docker daemon:
$ sudo service docker restart  
  1. Now let's log out and log in again, and execute the docker run command one more time, without sudo this time. As you can see, you are now able to work with Docker as a normal, non-root user:
  1. That's it. Our Linux Docker installation is ready to play with. Let's do an installation on the Windows box now.
主站蜘蛛池模板: 法库县| 南通市| 江孜县| 津市市| 永顺县| 响水县| 浠水县| 同仁县| 博兴县| 浏阳市| 栾川县| 夏邑县| 会泽县| 鱼台县| 阿拉尔市| 金湖县| 沁源县| 曲松县| 思南县| 于都县| 宜宾市| 弥渡县| 若尔盖县| 洛隆县| 湖州市| 甘谷县| 柳林县| 威宁| 临武县| 尼木县| 澳门| 墨玉县| 孝感市| 水城县| 南漳县| 连城县| 华阴市| 宜丰县| 南漳县| 大同县| 筠连县|