Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit13d7466

Browse files
authored
docs: add Docker quickstart (#2875)
* Fix docker-compose file* Add docker quickstart
1 parent5eecbaa commit13d7466

File tree

11 files changed

+187
-61
lines changed

11 files changed

+187
-61
lines changed

‎docker-compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
version:"3.9"
22
services:
33
coder:
4-
image:ghcr.io/coder/coder:v${CODER_VERSION:-latest}
4+
# This MUST be stable for our documentation and
5+
# other automations.
6+
image:ghcr.io/coder/coder:${CODER_VERSION:-latest}
57
ports:
68
-"7080:7080"
79
environment:

‎docs/ides/configuring-web-ides.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ You'll also need to specify a `coder_app` resource related to the agent. This is
7070
```hcl
7171
resource "coder_app" "code-server" {
7272
agent_id = coder_agent.dev.id
73-
name = "VS Code"
73+
name = "code-server"
7474
url = "http://localhost:13337/?folder=/home/coder"
75-
icon = "/code.svg"
75+
icon = "/icon/code.svg"
7676
}
7777
```
7878

Loading
152 KB
Loading
739 KB
Loading

‎docs/install.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,16 @@ Coder](https://github.com/coder/coder/releases) installed.
5555
git clone https://github.com/coder/coder.git
5656
```
5757

58-
2. Navigate into the`coder` folder. Coder requires a non-`localhost` access URL
59-
for non-Docker-based examples; if you have a public IP or a domain/reverse
60-
proxy, you can provide this value before running`docker-compose up` to
61-
start the service:
58+
2. Navigate into the`coder` folder and run`docker-compose up`:
6259

6360
```console
6461
cd coder
62+
# Coder will bind to localhost:7080.
63+
# You may use localhost:7080 as your access URL
64+
# when using Docker workspaces exclusively.
65+
# CODER_ACCESS_URL=http://localhost:7080
66+
# Otherwise, an internet accessible access URL
67+
# is required.
6568
CODER_ACCESS_URL=https://coder.mydomain.com
6669
docker-compose up
6770
```

‎docs/manifest.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,21 @@
3939
"title":"Quickstart",
4040
"description":"Create your first template and workspace",
4141
"icon":"<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-uqopch\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\"><path d=\"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"></path></svg>",
42-
"path":"./quickstart.md"
42+
"path":"./quickstart.md",
43+
"children": [
44+
{
45+
"title":"Docker",
46+
"description":"Setup Coder with Docker",
47+
"icon":"<?xml version=\"1.0\" ?><svg viewBox=\"0 0 640 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M349.9 236.3h-66.1v-59.4h66.1v59.4zm0-204.3h-66.1v60.7h66.1V32zm78.2 144.8H362v59.4h66.1v-59.4zm-156.3-72.1h-66.1v60.1h66.1v-60.1zm78.1 0h-66.1v60.1h66.1v-60.1zm276.8 100c-14.4-9.7-47.6-13.2-73.1-8.4-3.3-24-16.7-44.9-41.1-63.7l-14-9.3-9.3 14c-18.4 27.8-23.4 73.6-3.7 103.8-8.7 4.7-25.8 11.1-48.4 10.7H2.4c-8.7 50.8 5.8 116.8 44 162.1 37.1 43.9 92.7 66.2 165.4 66.2 157.4 0 273.9-72.5 328.4-204.2 21.4.4 67.6.1 91.3-45.2 1.5-2.5 6.6-13.2 8.5-17.1l-13.3-8.9zm-511.1-27.9h-66v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm-78.1-72.1h-66.1v60.1h66.1v-60.1z\"\/><\/svg>",
48+
"path":"./quickstart/docker.md"
49+
},
50+
{
51+
"title":"Generic",
52+
"description":"Setup Coder on anything",
53+
"icon": "<svg viewBox=\"0 0 32 32\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><ellipse cx=\"16\" cy=\"16\" rx=\"4\" ry=\"3.11\" transform=\"rotate(-30 15.991 16.005)\" fill=\"#ffffff\" class=\"fill-00bbff\"><\/ellipse><ellipse cx=\"16\" cy=\"16\" rx=\"4\" ry=\"3.11\" transform=\"rotate(-30 15.991 16.005)\" fill=\"none\" stroke=\"#ffffff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2px\" class=\"stroke-000000\"><\/ellipse><path d=\"M29 8.5c1.93 3.35-.18 8.19-4.73 10.82s-9.8 2-11.73-1.32\" fill=\"none\" stroke=\"#ffffff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2px\" class=\"stroke-000000\"><\/path><path d=\"M17.49 3.06c4.69-.48 8.08 2.78 7.56 7.28a8.47 8.47 0 0 1-.18 1M4.46 11c2.76-3.83 8.27-5.51 12.31-3.76s5.07 6.27 2.31 10.1\" fill=\"none\" stroke=\"#ffffff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2px\" class=\"stroke-000000\"><\/path><path d=\"M3 23.5c-1.93-3.35.18-8.19 4.73-10.82q.43-.25.86-.45M14.56 28.53C9.86 29 6.47 25.84 7 21.46s4.72-8.32 9.41-8.8\" fill=\"none\" stroke=\"#ffffff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2px\" class=\"stroke-000000\"><\/path><path d=\"M27.54 21c-2.76 3.83-8.27 5.51-12.31 3.76a7.44 7.44 0 0 1-.72-.36\" fill=\"none\" stroke=\"#ffffff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2px\" class=\"stroke-000000\"><\/path><\/svg>",
54+
"path":"./quickstart/generic.md"
55+
}
56+
]
4357
},
4458
{
4559
"title":"Templates",

‎docs/quickstart.md

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,6 @@
11
#Quickstart
22

3-
##Prerequisites
3+
See our[Docker quickstart](./quickstart/docker.md) for the easiest
4+
possible way to use Coder.
45

5-
Please[install Coder](./install.md) before proceeding with the steps outlined in this article.
6-
7-
##Creating your first template and workspace
8-
9-
In a new terminal window, run the following to copy a sample template:
10-
11-
```bash
12-
coder templates init
13-
```
14-
15-
Follow the CLI instructions to select an example that you can modify for your
16-
specific usage (e.g., a template to**Develop code-server in Docker**):
17-
18-
1. Navigate into your new templates folder and create your first template using
19-
the provided command (e.g.,`cd ./docker-code-server && coder templates create`)
20-
21-
1. Answer the CLI prompts; when done, confirm that you want to create your template.
22-
23-
Create a workspace using your template:
24-
25-
```bash
26-
coder create --template="yourTemplate"<workspaceName>
27-
```
28-
29-
Connect to your workspace via SSH:
30-
31-
```bash
32-
coder ssh<workspaceName>
33-
```
34-
35-
You can also access your workspace using the**access URL** you provided when
36-
deploying Coder (if you're using a temporary deployment and you opted to use
37-
Coder's tunnel, use the access URL you were provided). Log in with the admin
38-
credentials provided to you by Coder.
39-
40-
![Coder Web UI with code-server](images/code-server.png)
41-
42-
##Modifying templates
43-
44-
You can edit the Terraform template as follows:
45-
46-
```sh
47-
coder templates init
48-
cd gcp-linux# modify this line as needed to access the template
49-
vim main.tf
50-
coder templates update gcp-linux# updates the template
51-
```
6+
Otherwise, you can check out the[generic quickstart](./quickstart/generic.md).

‎docs/quickstart/docker.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#Docker
2+
3+
Coder with Docker has the following advantages:
4+
5+
- Simple installation (everything is on a single box)
6+
- Workspace images are easily configured
7+
- Workspaces share resources for burst operations
8+
9+
##Requirements
10+
11+
- A single MacOS or Linux box
12+
- A running Docker daemon
13+
14+
##Instructions
15+
16+
1.[Install and launch Coder](../install.md)
17+
18+
You may use`CODER_ACCESS_URL=http://localhost:7080` since we're using local
19+
Docker workspaces exclusively. The rest of the guide will assume that this is your
20+
access URL.
21+
22+
```bash
23+
coder server -a$CODER_ACCESS_URL
24+
```
25+
26+
1. Run`coder login http://localhost:7080`in a new terminal and follow the
27+
interactive instructions to create your user.
28+
29+
1. Pull the example template:
30+
31+
```bash
32+
echo"docker"| coder templates init
33+
cd docker
34+
# You should see a `main.tf` file in this directory
35+
```
36+
37+
1. Open up`main.tf`in your preferred editor to edit the images
38+
39+
You can skip this stepif you're fine with our default, generic OS images.
40+
41+
Search for the following section in `main.tf`:
42+
43+
```hcl
44+
...
45+
variable "docker_image" {
46+
description = "Which Docker image would you like to use for your workspace?"
47+
# The codercom/enterprise-* images are only built for amd64
48+
default = "codercom/enterprise-base:ubuntu"
49+
validation {
50+
condition = contains(["codercom/enterprise-base:ubuntu", "codercom/enterprise-node:ubuntu",
51+
"codercom/enterprise-intellij:ubuntu", "codercom/enterprise-golang:ubuntu"], var.docker_image)
52+
error_message = "Invalid Docker image!"
53+
}
54+
}
55+
...
56+
```
57+
58+
And edit the strings in `condition = contains([...])` and `default = ...`
59+
with your preferred images.
60+
61+
1. Push up the template to Coder with `coder templates create`
62+
1. Open the dashboard in your browser (http://localhost:7080) to create your
63+
first workspace:
64+
65+
<img src="./images/quickstart/docker/login.png">
66+
67+
Then navigate to `Templates > docker > Create workspace`
68+
69+
<img src="./images/quickstart/docker/create-workspace.png">
70+
71+
Now wait a few moments for the workspace to build... After the first build
72+
the image is cached and subsequent builds will take a few seconds.
73+
74+
1. All done!
75+
76+
<img src="./images/quickstart/docker/ides.png">
77+
78+
Open up a web application or [SSH in](../ides.md#ssh-configuration).
79+
80+
## Next Steps
81+
82+
- [Learn more about template configuration](../templates.md)
83+
- [Configure more IDEs](../ides/configuring-web-ides.md)

‎docs/quickstart/generic.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
##Prerequisites
2+
3+
Please[install Coder](./install.md) before proceeding with the steps outlined in this article.
4+
5+
##Creating your first template and workspace
6+
7+
In a new terminal window, run the following to copy a sample template:
8+
9+
```bash
10+
coder templates init
11+
```
12+
13+
Follow the CLI instructions to select an example that you can modify for your
14+
specific usage (e.g., a template to**Develop code-server in Docker**):
15+
16+
1. Navigate into your new templates folder and create your first template using
17+
the provided command (e.g.,`cd ./docker-code-server && coder templates create`)
18+
19+
1. Answer the CLI prompts; when done, confirm that you want to create your template.
20+
21+
Create a workspace using your template:
22+
23+
```bash
24+
coder create --template="yourTemplate"<workspaceName>
25+
```
26+
27+
Connect to your workspace via SSH:
28+
29+
```bash
30+
coder ssh<workspaceName>
31+
```
32+
33+
You can also access your workspace using the**access URL** you provided when
34+
deploying Coder (if you're using a temporary deployment and you opted to use
35+
Coder's tunnel, use the access URL you were provided). Log in with the admin
36+
credentials provided to you by Coder.
37+
38+
![Coder Web UI with code-server](images/code-server.png)
39+
40+
##Modifying templates
41+
42+
You can edit the Terraform template as follows:
43+
44+
```sh
45+
coder templates init
46+
cd gcp-linux# modify this line as needed to access the template
47+
vim main.tf
48+
coder templates update gcp-linux# updates the template
49+
```

‎examples/templates/docker/main.tf

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,24 @@ data "coder_workspace" "me" {
6666
}
6767

6868
resource"coder_agent""dev" {
69-
arch=var.step2_arch
70-
os="linux"
69+
arch=var.step2_arch
70+
os="linux"
71+
startup_script=<<EOF
72+
#!/bin/sh
73+
# install and start code-server
74+
curl -fsSL https://code-server.dev/install.sh | sh
75+
code-server --auth none --port 13337
76+
EOF
7177
}
7278

79+
resource"coder_app""code-server" {
80+
agent_id=coder_agent.dev.id
81+
name="code-server"
82+
url="http://localhost:13337/?folder=/home/coder"
83+
icon="/icon/code.svg"
84+
}
85+
86+
7387
variable"docker_image" {
7488
description="Which Docker image would you like to use for your workspace?"
7589
# The codercom/enterprise-* images are only built for amd64
@@ -83,7 +97,7 @@ variable "docker_image" {
8397
}
8498

8599
resource"docker_volume""home_volume" {
86-
name="coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
100+
name="coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-home"
87101
}
88102

89103
resource"docker_container""workspace" {
@@ -95,8 +109,14 @@ resource "docker_container" "workspace" {
95109
hostname=lower(data.coder_workspace.me.name)
96110
dns=["1.1.1.1"]
97111
# Use the docker gateway if the access URL is 127.0.0.1
98-
command=["sh","-c",replace(coder_agent.dev.init_script,"127.0.0.1","host.docker.internal")]
99-
env=["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
112+
command=[
113+
"sh","-c",
114+
<<EOT
115+
trap '[ $? -ne 0 ] && echo === Agent script exited with non-zero code. Sleeping infinitely to preserve logs... && sleep infinity' EXIT
116+
${replace(coder_agent.dev.init_script,"localhost","host.docker.internal")}
117+
EOT
118+
]
119+
env=["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
100120
host {
101121
host="host.docker.internal"
102122
ip="host-gateway"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp