You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Deploy container networking for a stand-alone Linux Docker host
14
14
15
-
The Azure CNI plugin enables per container/pod networking for stand-alone docker hosts and Kubernetes clusters. In this article, you'll learn how to install and configure the CNI plugin for a standalone Linux Docker host.
15
+
The Azure CNI plugin enables per container/pod networking for stand-alone docker hosts and Kubernetes clusters. In this article, you learn how to install and configure the CNI plugin for a standalone Linux Docker host.
16
16
17
17
## Prerequisites
18
18
19
19
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
20
20
21
-
## Create virtual network
22
-
23
-
A virtual network contains the virtual machine used in this article. In this section, you'll create a virtual network and subnet. You'll enable Azure Bastion during the virtual network deployment. The Azure Bastion host is used to securely connect to the virtual machine to complete the steps in this article.
24
-
25
-
1. Sign in to the [Azure portal](https://portal.azure.com).
26
-
27
-
2. In the search box at the top of the portal, enter **Virtual network**. Select **Virtual networks** in the search results.
28
-
29
-
3. Select **+ Create**.
30
-
31
-
4. Enter or select the following information in the **Basics** tab of **Create virtual network**:
32
-
33
-
| Setting | Value |
34
-
| ------- | ----- |
35
-
|**Project details**||
36
-
| Subscription | Select your subscription. |
37
-
| Resource group | Select **Create new**. </br> Enter **myResourceGroup** in **Name**. </br> Select **OK**. |
38
-
|**Instance details**||
39
-
| Name | Enter **myVNet**. |
40
-
| Region | Select a region. |
41
-
42
-
5. Select **Next: IP Addresses**.
43
-
44
-
6. In **IPv4 address space**, enter **10.1.0.0/16**.
It can take a few minutes for the Bastion host to deploy. You can continue with the steps while the Bastion host is deploying.
77
24
78
-
## Create virtual machine
79
-
80
-
In this section, you'll create an Ubuntu virtual machine for the stand-alone Docker host. Ubuntu is used for the example in this article. The CNI plug-in supports Windows and other Linux distributions.
81
-
82
-
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
The Azure CNI plugin allocates IP addresses to containers based on a pool of IP addresses you create on the virtual network interface of the virtual machine. For every container on the host, an IP configuration must exist on the virtual network interface. If the number of containers on the server outnumber the IP configurations on the virtual network interface, the container will start but won't have an IP address.
29
+
The Azure CNI plugin allocates IP addresses to containers based on a pool of IP addresses you create on the virtual network interface of the virtual machine. For every container on the host, an IP configuration must exist on the virtual network interface. If the number of containers on the server outnumber the IP configurations on the virtual network interface, the container starts but doesn't have an IP address.
128
30
129
-
In this section, you'll add an IP configuration to the virtual network interface of the virtual machine you created previously.
31
+
In this section, you add an IP configuration to the virtual network interface of the virtual machine you created previously.
130
32
131
33
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
132
34
133
-
2. Select **myVM**.
35
+
1. Select **vm-1**.
134
36
135
-
3. In **Settings**, select **Networking**.
37
+
1. In **Settings**, select **Networking**.
136
38
137
-
4. Select the name of the network interface next to **Network Interface:**. The network interface is named **myvm** with a random number. In this example, it's **myvm27**.
39
+
1. Select the name of the network interface next to **Network Interface:**. The network interface is named **vm-1** with a random number.
138
40
139
-
5. In **Settings** of the network interface, select **IP configurations**.
41
+
1. In **Settings** of the network interface, select **IP configurations**.
140
42
141
-
6. in **IP configurations**, select **ipconfig1** in **Name**.
43
+
1. in **IP configurations**, select **ipconfig1** in **Name**.
142
44
143
-
7. In the **ipconfig1** settings, change the assignment of the private IP address from **Dynamic** to **Static**.
45
+
1. In the **ipconfig1** settings, change the assignment of the private IP address from **Dynamic** to **Static**.
144
46
145
-
8. Select **Save**.
47
+
1. Select **Save**.
146
48
147
-
9. Return to **IP configurations**.
49
+
1. Return to **IP configurations**.
148
50
149
-
10. Select **+ Add**.
51
+
1. Select **+ Add**.
150
52
151
-
11. Enter or select the following information for **Add IP configuration**:
53
+
1. Enter or select the following information for **Add IP configuration**:
152
54
153
55
| Setting | Value |
154
56
| ------- | ----- |
155
-
| Name | Enter **ipconfig2**. |
57
+
| Name | Enter **ipconfig-2**. |
156
58
|**Private IP address settings**||
157
59
| Allocation | Select **Static**. |
158
-
| IP address | Enter **10.1.0.5**. |
60
+
| IP address | Enter **10.0.0.5**. |
159
61
160
-
12. Select **OK**.
62
+
1. Select **OK**.
161
63
162
-
13. Verify **ipconfig2** has been added as a secondary IP configuration.
64
+
1. Verify **ipconfig-2** has been added as a secondary IP configuration.
163
65
164
-
Repeat steps 1 through 13 to add as many configurations as containers you wish to deploy on the container host.
66
+
Repeat the previous steps to add as many configurations as containers you wish to deploy on the container host.
165
67
166
68
## Install Docker
167
69
@@ -171,13 +73,13 @@ Sign-in to the virtual machine you created previously with the Azure Bastion hos
171
73
172
74
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
173
75
174
-
2. Select **myVM**.
76
+
1. Select **vm-1**.
175
77
176
-
3. In the **Overview** of **myVM**, select **Connect** then **Bastion**.
78
+
1. In the **Overview** of **vm-1**, select **Connect** then **Bastion**.
177
79
178
-
4. Enter the username and password you created when you deployed the virtual machine in the previous steps.
80
+
1. Enter the username and password you created when you deployed the virtual machine in the previous steps.
179
81
180
-
5. Select **Connect**.
82
+
1. Select **Connect**.
181
83
182
84
For install instructions for Docker on an Ubuntu container host, see [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/).
183
85
@@ -187,33 +89,33 @@ After Docker is installed on your virtual machine, continue with the steps in th
187
89
188
90
## Install CNI plugin and create a test container
189
91
190
-
The Azure CNI plugin is maintained as a GitHub project and is available for download from the project's GitHub page. For this article, you'll use **`git`** within the virtual machine to clone the repository for the plugin and then install and configure the plugin.
92
+
The Azure CNI plugin is maintained as a GitHub project and is available for download from the project's GitHub page. For this article, you use **`git`** within the virtual machine to clone the repository for the plugin and then install and configure the plugin.
191
93
192
94
For more information about the Azure CNI plugin, see [Microsoft Azure Container Networking](https://github.com/Azure/azure-container-networking).
193
95
194
96
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
195
97
196
-
2. Select **myVM**.
98
+
1. Select **vm-1**.
197
99
198
-
3. In the **Overview** of **myVM**, select **Connect** then **Bastion**.
100
+
1. In the **Overview** of **vm-1**, select **Connect** then **Bastion**.
199
101
200
-
4. Enter the username and password you created when you deployed the virtual machine in the previous steps.
102
+
1. Enter the username and password you created when you deployed the virtual machine in the previous steps.
201
103
202
-
5. Select **Connect**.
104
+
1. Select **Connect**.
203
105
204
-
6. The application **jq** is required for the install script for the CNI plugin, use the following example to install the application:
106
+
1. The application **jq** is required for the install script for the CNI plugin, use the following example to install the application:
205
107
206
108
```bash
207
109
sudo apt-get update
208
110
sudo apt-get install jq
209
111
```
210
-
7. Next, you'll clone the repository for the CNI plugin. Use the following example to clone the repository:
112
+
1. Next, you clone the repository for the CNI plugin. Use the following example to clone the repository:
8. Configure permissions and install the CNI plugin. The install script command requires a version number for the CNI plugin. At the time of the writing of this article, the newest version is **`v1.4.39`**. To obtain the latest version number of the plugin or previous versions, see [Releases](https://github.com/Azure/azure-container-networking/releases).
118
+
1. Configure permissions and install the CNI plugin. The install script command requires a version number for the CNI plugin. At the time of the writing of this article, the newest version is **`v1.4.39`**. To obtain the latest version number of the plugin or previous versions, see [Releases](https://github.com/Azure/azure-container-networking/releases).
217
119
218
120
```bash
219
121
cd ./azure-container-networking/scripts
@@ -222,38 +124,26 @@ For more information about the Azure CNI plugin, see [Microsoft Azure Container
222
124
chmod u+x docker-run.sh
223
125
```
224
126
225
-
9. To start a container with the CNI plugin, you must use a special script that comes with the plugin to create and start the container. The following example will create an Alpine container with the CNI plugin script:
127
+
1. To start a container with the CNI plugin, you must use a special script that comes with the plugin to create and start the container. The following example creates an Alpine container with the CNI plugin script:
226
128
227
129
```bash
228
130
sudo ./docker-run.sh vnetdocker1 default alpine
229
131
```
230
132
231
-
10. To verify that the container received the IP address you previously configured, connect to the container and view the IP:
133
+
1. To verify that the container received the IP address you previously configured, connect to the container and view the IP:
232
134
233
135
```bash
234
136
sudo docker exec -it vnetdocker1 /bin/sh
235
137
```
236
138
237
-
11. Use the **`ifconfig`** command in the following example to verify the IP address was assigned to the container:
139
+
1. Use the **`ifconfig`**commandin the following example to verify the IP address was assigned to the container:
238
140
239
141
```bash
240
142
ifconfig
241
143
```
242
144
:::image type="content" source="./media/deploy-container-networking-docker-linux/ifconfig-output.png" alt-text="Screenshot of ifconfig output in Bash prompt of test container.":::
243
145
244
-
## Clean up resources
245
-
246
-
If you're not going to continue to use this application, delete the virtual network and virtual machine with the following steps:
247
-
248
-
1. In the search box at the top of the portal, enter **Resource group**. Select **Resource groups**in the search results.
249
-
250
-
2. Select **myResourceGroup**.
251
-
252
-
3. In the **Overview** of **myResourceGroup**, select**Delete resource group**.
253
-
254
-
4. In **TYPE THE RESOURCE GROUP NAME:**, enter **myResourceGroup**.
0 commit comments