mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
docs: simplify Docker quickstart (#4257)
This commit is contained in:
+18
-39
@@ -15,54 +15,29 @@ Coder with Docker has the following advantages:
|
||||
|
||||
1. [Install and launch Coder](../install)
|
||||
|
||||
You will specify `CODER_ACCESS_URL=http://localhost:7080` since we're using
|
||||
local Docker workspaces exclusively. `CODER_ACCESS_URL` is the external URL
|
||||
to access Coder. The rest of the Docker quickstart guide will assume that
|
||||
this is your Access URL.
|
||||
|
||||
You will also specify `CODER_ADDRESS=0.0.0.0:7080` which is the address to
|
||||
serve the API and dashboard.
|
||||
Next, we export the `CODER_ADDRESS` and `CODER_ACCESS_URL` environment
|
||||
variables. We can use localhost for the Access URL since the workspaces
|
||||
all run on the same machine. `CODER_ADDRESS` is where coder server binds
|
||||
while `CODER_ACCESS_URL` is where it's accessed. We use `:7080` to bind
|
||||
to all interfaces.
|
||||
|
||||
```bash
|
||||
coder server --address $CODER_ADDRESS --access-url $CODER_ACCESS_URL
|
||||
$ export CODER_ADDRESS=:7080
|
||||
$ export CODER_ACCESS_URL=http://localhost:7080
|
||||
$ coder server --address $CODER_ADDRESS --access-url $CODER_ACCESS_URL
|
||||
```
|
||||
|
||||
1. Run `coder login http://localhost:7080` in a new terminal and follow the
|
||||
interactive instructions to create your user.
|
||||
|
||||
1. Pull the example template:
|
||||
1. Pull the "Docker" example template using the interactive `coder templates init`:
|
||||
|
||||
```bash
|
||||
echo "docker" | coder templates init
|
||||
cd docker
|
||||
# You should see a `main.tf` file in this directory
|
||||
$ coder templates init
|
||||
$ cd docker
|
||||
```
|
||||
|
||||
1. Open up `main.tf` in your preferred editor to edit the images
|
||||
|
||||
You can skip this step if you're fine with our default, generic OS images.
|
||||
|
||||
Search for the following section in `main.tf`:
|
||||
|
||||
```hcl
|
||||
...
|
||||
variable "docker_image" {
|
||||
description = "Which Docker image would you like to use for your workspace?"
|
||||
# The codercom/enterprise-* images are only built for amd64
|
||||
default = "codercom/enterprise-base:ubuntu"
|
||||
validation {
|
||||
condition = contains(["codercom/enterprise-base:ubuntu", "codercom/enterprise-node:ubuntu",
|
||||
"codercom/enterprise-intellij:ubuntu", "codercom/enterprise-golang:ubuntu"], var.docker_image)
|
||||
error_message = "Invalid Docker image!"
|
||||
}
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
And edit the strings in `condition = contains([...])` and `default = ...`
|
||||
with your preferred images.
|
||||
|
||||
1. Push up the template to Coder with `coder templates create`
|
||||
1. Push up the template with `coder templates create`
|
||||
1. Open the dashboard in your browser (http://localhost:7080) to create your
|
||||
first workspace:
|
||||
|
||||
@@ -72,16 +47,20 @@ Coder with Docker has the following advantages:
|
||||
|
||||
<img src="../images/quickstart/docker/create-workspace.png">
|
||||
|
||||
Now wait a few moments for the workspace to build... After the first build
|
||||
Now wait a few moments for the workspace to build... After the first build,
|
||||
the image is cached and subsequent builds will take a few seconds.
|
||||
|
||||
1. All done!
|
||||
1. Your workspace is ready to go!
|
||||
|
||||
<img src="../images/quickstart/docker/ides.png">
|
||||
|
||||
Open up a web application or [SSH in](../ides.md#ssh-configuration).
|
||||
|
||||
1. If you want to modify the Docker image or template, edit the files in the
|
||||
previously created `./docker` directory, then run `coder templates push`.
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Port-forward](../networking/port-forwarding.md.md)
|
||||
- [Learn more about template configuration](../templates.md)
|
||||
- [Configure more IDEs](../ides/web-ides.md)
|
||||
|
||||
Reference in New Issue
Block a user