Merge "updating offered consumed api .rst file"
[so.git] / docs / Install_Docker.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.\r
2 .. http://creativecommons.org/licenses/by/4.0\r
3 .. Copyright 2017 Huawei Technologies Co., Ltd.\r
4 \r
5 Install Docker\r
6 ===============\r
7 \r
8 Make sure curl is installed on the Ubuntu VM:\r
9 \r
10 .. code-block:: bash\r
11 \r
12         sudo apt update\r
13         sudo apt install curl\r
14 \r
15 If you are behind a corporate firewall (replace "proxyhost:port" with your actual proxy information)\r
16         https_proxy="https://*proxyhost:port*" curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -\r
17         \r
18 Otherwise:\r
19         curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -\r
20 Expected Response:\r
21         OK\r
22 Add the docker package repository:\r
23         sudo apt-add-repository "deb https://apt.dockerproject.org/repo ubuntu-xenial main"\r
24         \r
25 Install packages:\r
26 \r
27 .. code-block:: bash\r
28 \r
29     sudo apt update\r
30     sudo apt-cache policy docker-engine\r
31         sudo apt install docker-engine\r
32         sudo apt install docker-compose\r
33         \r
34 If you are behind a corporate firewall, you will need to configure proxy settings for docker so that images may be obtained from internet repositories.  In the commands shown here, replace *"proxyhost:port"*, *"yourdomain1.com"*, and *"yourdomain2.com"* with appropriate values.\r
35         \r
36     Make the docker configuration directory:\r
37 \r
38 .. code-block:: bash\r
39         \r
40         sudo mkdir -p /etc/systemd/system/docker.service.d\r
41         \r
42     Edit (create) this file:\r
43 \r
44 .. code-block:: bash\r
45         \r
46                 sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf\r
47         \r
48     Add these lines:\r
49 \r
50         [Service]\r
51         \r
52                 Environment="HTTP_PROXY=https://*proxyhost:port*"\r
53         \r
54                 Environment="HTTPS_PROXY=https://*proxyhost:port*"\r
55         \r
56                 Environment="NO_PROXY=localhost,127.0.0.1,.yourdomain1.com,.yourdomain2.com"\r
57         \r
58     Restart docker:\r
59 \r
60 .. code-block:: bash\r
61         \r
62         sudo systemctl daemon-reload\r
63         sudo systemctl restart docker\r
64 \r
65 Add yourself to the docker user group (replace "userid" with your user ID):\r
66 \r
67 .. code-block:: bash\r
68 \r
69     sudo usermod -a -G docker *userid*\r
70 \r
71 Log out and log back in so that the user group change will takeeffect.\r
72 \r
73 Verify that you can connect to docker as yourself (i.e. not as root):\r
74 \r
75 .. code-block:: bash\r
76 \r
77     docker ps\r
78 \r
79 Verify that you can download and run the hello-world container\r
80 \r
81 .. code-block:: bash\r
82 \r
83     docker run hello-world\r
84         \r
85 .. image:: images/Docker_install_1.png