Skip to content

Instantly share code, notes, and snippets.

@JfrAziz
Last active March 20, 2022 12:22
Show Gist options
  • Save JfrAziz/1637e7206305838bb04e3f4c1e894eaf to your computer and use it in GitHub Desktop.
Save JfrAziz/1637e7206305838bb04e3f4c1e894eaf to your computer and use it in GitHub Desktop.
Run Code Server Using docker-compose

To run docker container using docker compose docker-compose up.

and if you want to update password to hased password, first create a new password using command echo -n "password" | argon2 passphrase -e and then copy the hashed password to config.yml in ./.config/code-server/config.yaml and change password to hashed-password like this

bind-addr: 127.0.0.1:8080
auth: password
hashed-password: "$argon2i$v=19$m=4096,t=3,p=1$cGFzc3BocmFzZQ$okkrFbM7upiCdoRdy3EWd7PXPdwXgN4lCaTY9MupgYo"
cert: false

if your run docker-compose with sudo, make folder .local, .config, and project in current directory and change the owner to your current user, like sudo chown -R $USER:$USER .local etc.

version: "3.1"
services:
vscode:
container_name: vscode
image: codercom/code-server
ports:
- "8080:8080"
volumes:
- ./.config:/home/coder/.config
- ./.local:/home/code/.local
- ./project:/home/coder/project
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_pass http://127.0.0.1:8080;
}
client_max_body_size 50m;
}
@idchlife
Copy link

Unfortunately docker-compose up could not start. Firing up with root user.

Starting vscode ... done
Attaching to vscode
vscode | [2022-03-20T11:14:47.163Z] error EACCES: permission denied, mkdir '/home/coder/.config/code-server'

I tried doing chown, no luck. I also tried privileged: true - still no luck.

Should I create separate user for this or something?

@JfrAziz
Copy link
Author

JfrAziz commented Mar 20, 2022

change owner of .local and .config folder recursively by sudo chown -R $USER:$USER .local

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment