Skip to content

Commit ccc6f6f

Browse files
authored
Merge branch 'MicrosoftDocs:main' into patch-8
2 parents 67f31c5 + 9943695 commit ccc6f6f

File tree

4 files changed

+100
-332
lines changed

4 files changed

+100
-332
lines changed

articles/virtual-network/deploy-container-networking-docker-linux.md

Lines changed: 37 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -6,162 +6,64 @@ author: asudbring
66
ms.author: allensu
77
ms.service: virtual-network
88
ms.topic: how-to
9-
ms.date: 12/22/2022
9+
ms.date: 08/28/2023
1010
ms.custom: template-how-to
1111
---
1212

1313
# Deploy container networking for a stand-alone Linux Docker host
1414

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.
1616

1717
## Prerequisites
1818

1919
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2020

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**.
45-
46-
7. Select **+ Add subnet**.
47-
48-
8. Enter or select the following information:
49-
50-
| Setting | Value |
51-
| ------- | ----- |
52-
| Subnet name | Enter **mySubnet**. |
53-
| Subnet address range | Enter **10.1.0.0/24**. |
54-
55-
9. Select **Add**.
56-
57-
10. Select **Next: Security**.
58-
59-
11. Select **Enable** in **BastionHost**.
60-
61-
>[!NOTE]
62-
>[!INCLUDE [Pricing](../../includes/bastion-pricing.md)]
63-
64-
12. Enter or select the following information:
65-
66-
| Setting | Value |
67-
| ------- | ----- |
68-
| Bastion name | Enter **myBastion**. |
69-
| AzureBastionSubnet address space | Enter **10.1.1.0/26**. |
70-
| Public IP address | Select **Create new**. </br> Enter **myBastionIP** in **Name**. </br> Select **OK**. |
71-
72-
13. Select **Review + create**.
73-
74-
14. Select **Create**.
21+
[!INCLUDE [virtual-network-create-with-bastion.md](../../includes/virtual-network-create-with-bastion.md)]
7522

7623
It can take a few minutes for the Bastion host to deploy. You can continue with the steps while the Bastion host is deploying.
7724

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.
83-
84-
2. Select **+ Create** > **Azure virtual machine**.
85-
86-
3. Enter or select the following information in the **Basics** tab of **Create a virtual machine**:
87-
88-
| Setting | Value |
89-
| ------- | ----- |
90-
| **Project details** | |
91-
| Subscription | Select your subscription. |
92-
| Resource group | Select **myResourceGroup**. |
93-
| **Instance details** | |
94-
| Virtual machine name | Enter **myVM**. |
95-
| Region | Select a region. |
96-
| Availability options | Select **No infrastructure required**. |
97-
| Security type | Select **Standard**. |
98-
| Image | Select **Ubuntu Server 20.04 LTS -x64 Gen2**. |
99-
| VM architecture | Leave the default of **x64**. |
100-
| Run with Azure Spot discount | Leave the default of unchecked. |
101-
| Size | Select a size. |
102-
| **Administrator account** | |
103-
| Authentication type | Select **Password**. |
104-
| Username | Enter a username. |
105-
| Password | Enter a password. |
106-
| Confirm password | Reenter password. |
107-
| **Inbound port rules** | |
108-
| Public inbound ports | Select **None**. |
109-
110-
4. Select **Next: Disks**, then **Next: Networking**.
111-
112-
5. Enter or select the following information in the **Networking** tab:
113-
114-
| Setting | Value |
115-
| ------- | ----- |
116-
| **Network interface** | |
117-
| Virtual network | Select **myVNet**. |
118-
| Subnet | Select **mySubnet (10.1.0.0/24)**. |
119-
| Public IP | Select **None**. |
120-
121-
6. Select **Review + create**.
122-
123-
7. Select **Create**
25+
[!INCLUDE [create-test-virtual-machine-linux.md](../../includes/create-test-virtual-machine-linux.md)]
12426

12527
## Add IP configuration
12628

127-
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.
12830

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.
13032

13133
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
13234

133-
2. Select **myVM**.
35+
1. Select **vm-1**.
13436

135-
3. In **Settings**, select **Networking**.
37+
1. In **Settings**, select **Networking**.
13638

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.
13840

139-
5. In **Settings** of the network interface, select **IP configurations**.
41+
1. In **Settings** of the network interface, select **IP configurations**.
14042

141-
6. in **IP configurations**, select **ipconfig1** in **Name**.
43+
1. in **IP configurations**, select **ipconfig1** in **Name**.
14244

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**.
14446

145-
8. Select **Save**.
47+
1. Select **Save**.
14648

147-
9. Return to **IP configurations**.
49+
1. Return to **IP configurations**.
14850

149-
10. Select **+ Add**.
51+
1. Select **+ Add**.
15052

151-
11. Enter or select the following information for **Add IP configuration**:
53+
1. Enter or select the following information for **Add IP configuration**:
15254

15355
| Setting | Value |
15456
| ------- | ----- |
155-
| Name | Enter **ipconfig2**. |
57+
| Name | Enter **ipconfig-2**. |
15658
| **Private IP address settings** | |
15759
| Allocation | Select **Static**. |
158-
| IP address | Enter **10.1.0.5**. |
60+
| IP address | Enter **10.0.0.5**. |
15961

160-
12. Select **OK**.
62+
1. Select **OK**.
16163

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.
16365

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.
16567

16668
## Install Docker
16769

@@ -171,13 +73,13 @@ Sign-in to the virtual machine you created previously with the Azure Bastion hos
17173

17274
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
17375

174-
2. Select **myVM**.
76+
1. Select **vm-1**.
17577

176-
3. In the **Overview** of **myVM**, select **Connect** then **Bastion**.
78+
1. In the **Overview** of **vm-1**, select **Connect** then **Bastion**.
17779

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.
17981

180-
5. Select **Connect**.
82+
1. Select **Connect**.
18183

18284
For install instructions for Docker on an Ubuntu container host, see [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/).
18385

@@ -187,33 +89,33 @@ After Docker is installed on your virtual machine, continue with the steps in th
18789

18890
## Install CNI plugin and create a test container
18991

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.
19193

19294
For more information about the Azure CNI plugin, see [Microsoft Azure Container Networking](https://github.com/Azure/azure-container-networking).
19395

19496
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
19597

196-
2. Select **myVM**.
98+
1. Select **vm-1**.
19799

198-
3. In the **Overview** of **myVM**, select **Connect** then **Bastion**.
100+
1. In the **Overview** of **vm-1**, select **Connect** then **Bastion**.
199101

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.
201103

202-
5. Select **Connect**.
104+
1. Select **Connect**.
203105

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:
205107

206108
```bash
207109
sudo apt-get update
208110
sudo apt-get install jq
209111
```
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:
211113

212114
```bash
213115
git clone https://github.com/Azure/azure-container-networking.git
214116
```
215117

216-
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).
217119

218120
```bash
219121
cd ./azure-container-networking/scripts
@@ -222,38 +124,26 @@ For more information about the Azure CNI plugin, see [Microsoft Azure Container
222124
chmod u+x docker-run.sh
223125
```
224126

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:
226128

227129
```bash
228130
sudo ./docker-run.sh vnetdocker1 default alpine
229131
```
230132

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:
232134

233135
```bash
234136
sudo docker exec -it vnetdocker1 /bin/sh
235137
```
236138

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`** command in the following example to verify the IP address was assigned to the container:
238140

239141
```bash
240142
ifconfig
241143
```
242144
:::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.":::
243145

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**.
255-
256-
5. Select **Delete**.
146+
[!INCLUDE [portal-clean-up.md](../../includes/portal-clean-up.md)]
257147

258148
## Next steps
259149

0 commit comments

Comments
 (0)