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
Copy file name to clipboardExpand all lines: docs/tutorials/deploy-container-using-the-cli.mdx
+31-6Lines changed: 31 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,23 +5,48 @@ sidebar_position: 200
5
5
6
6
# Deploy Existing Containers
7
7
8
-
This example is useful if you already have a Docker container built manually or through a CI/CD system and have that the resulting image is available in a public or private repository accessible by Defang.
8
+
This tutorial will show you how to deploy an existing container/multi-container application.
9
+
10
+
This example is rather useful if you already have a Docker container built manually, or through a CI/CD system where the resulting image is available in a public or private repository accessible by Defang.
11
+
But it is not required in order to follow along to this tutorial.
12
+
13
+
# Step 1 - Make a Docker Compose file
14
+
:::tip
15
+
If you are unfamiliar with Docker Compose files, check out the [Compose](/docs/concepts/compose) page.
16
+
:::
17
+
Create a `compose.yaml` file to define the [service(s)](/docs/concepts/services) in your application.
18
+
19
+
If you already have a Docker Compose file to define your service(s), you can use it directly and skip this step.
9
20
10
-
# Step 1 - Docker Compose
11
-
If you already have a Docker Compose file for your service(s) you can use it directly. Else you can create one like this:
12
21
13
22
```yaml
14
23
version: '3.9'
15
24
services:
16
-
service1:
17
-
# This is just an example, replace with the image you want
18
-
image: "docker.io/nginx:latest"
25
+
web:
26
+
image: nginx:latest
19
27
ports:
20
28
- mode: ingress
21
29
target: 3000
30
+
app:
31
+
build:
32
+
context: .
33
+
dockerfile: Dockerfile
34
+
ports:
35
+
- mode: ingress
36
+
target: 4000
37
+
redis:
38
+
image: redis:6.2
39
+
restart: unless-stopped
40
+
ports:
41
+
- mode: host
42
+
target: 6379
22
43
```
23
44
45
+
The example above shows a multi-container application with 3 services, `web`, `app`, `redis`.
46
+
If you wanted to deploy only one container, say `app`, then the example would remain the same, except without the `web` and `redis` services.
47
+
24
48
# Step 2 - Deploy
49
+
Run the following command in the [Defang CLI]((/docs/getting-started#install-the-defang-cli.md)).
0 commit comments