2022-07-11 12:05:05 -05:00
# Docker
Coder with Docker has the following advantages:
- Simple installation (everything is on a single box)
- Workspace images are easily configured
- Workspaces share resources for burst operations
## Requirements
2022-08-11 20:22:06 -05:00
- A single macOS or Linux box
2022-07-11 12:05:05 -05:00
- A running Docker daemon
## Instructions
2022-11-03 13:30:10 -05:00
1. Run Coder with Docker.
2022-07-11 12:05:05 -05:00
2022-12-13 13:31:09 -06:00
```console
2022-12-05 12:21:09 +01:00
export CODER_DATA=$HOME/.config/coderv2-docker
export DOCKER_GROUP=$(getent group docker | cut -d: -f3)
mkdir -p $CODER_DATA
docker run --rm -it \
-v $CODER_DATA:/home/coder/.config \
-v /var/run/docker.sock:/var/run/docker.sock \
--group-add $DOCKER_GROUP \
ghcr.io/coder/coder:latest
` ``
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
> This will use Coder's tunnel and built-in database. See our [Docker documentation](../install/docker.md) for other configuration options such as running on localhost, using docker-compose, and external PostgreSQL.
2022-10-19 11:30:27 -05:00
2022-12-05 12:21:09 +01:00
1. In new terminal, [install Coder](../install/) in order to connect to your deployment through the CLI.
2022-11-03 13:30:10 -05:00
2022-12-13 13:31:09 -06:00
` ``console
2022-12-05 12:21:09 +01:00
curl -L https://coder.com/install.sh | sh
` ``
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
1. Run ` coder login <access url>` and follow the
interactive instructions to create your user.
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
1. Pull the "Docker" example template using the interactive ` coder templates init`:
2022-07-11 12:05:05 -05:00
2022-12-13 13:31:09 -06:00
` ``console
2022-12-05 12:21:09 +01:00
coder templates init
cd docker
` ``
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
1. Push up the template with ` coder templates create`
2022-11-03 13:30:10 -05:00
2022-12-05 12:21:09 +01:00
1. Open the dashboard in your browser to create your
first workspace:
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
<img src="../images/quickstart/docker/login.png">
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
Then navigate to ` Templates > docker > Create workspace`
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
<img src="../images/quickstart/docker/create-workspace.png">
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
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.
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
1. Your workspace is ready to go!
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
<img src="../images/quickstart/docker/ides.png">
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
Open up a web application or [SSH in](../ides.md#ssh-configuration).
2022-07-11 12:05:05 -05:00
2022-12-05 12:21:09 +01:00
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`.
2022-09-29 17:55:15 -05:00
2022-10-19 11:30:27 -05:00
## Troubleshooting
### Docker-based workspace is stuck in "Connecting..."
Ensure you have an externally-reachable ` CODER_ACCESS_URL` set. See [troubleshooting templates ](../templates.md#creating-and-troubleshooting-templates ) for more steps.
### Permission denied while trying to connect to the Docker daemon socket
See Docker's official documentation to [Manage Docker as a non-root user ](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user ).
2022-07-11 12:05:05 -05:00
## Next Steps
2022-10-04 14:57:06 -05:00
- [Port-forward ](../networking/port-forwarding.md )
2022-07-11 12:05:05 -05:00
- [Learn more about template configuration ](../templates.md )
2022-08-09 20:10:09 -05:00
- [Configure more IDEs ](../ides/web-ides.md )