profile
viewpoint

Ask questionsEnforce user permissions for user data and extension dirs on container startup

Description

When we start code-server as a docker container and mounting a path for extensions we need to make sure on startup that it belongs to the same user as the code-server

Steps to Reproduce

use the oneliner from README.md

Result

docker run -it -p 127.0.0.1:8080:8080 -v "${HOME}/.local/share/code-server:/home/coder/.local/share/code-server" -v "$PWD:/home/coder/project" codercom/code-server
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
ERROR { [Error: EACCES: permission denied, mkdir '/home/coder/.local/share/code-server/extensions']
  [stack]:
   'Error: EACCES: permission denied, mkdir \'/home/coder/.local/share/code-server/extensions\'',
  [message]:
   'EACCES: permission denied, mkdir \'/home/coder/.local/share/code-server/extensions\'',
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/home/coder/.local/share/code-server/extensions' }

cdr/code-server

Answer questions frank-dspeed

@mukk85 current state is you manualy create the extensions dir befor you run the oneliner and chmod the folder right befor you start the oneliner

because when docker creates the folder while starting it will be owned by root

useful!
source:https://uonfu.com/
answerer
Frank Lemanschik frank-dspeed @direktspeed Europe https://dspeed.eu I Love Building Things to Build and Run Things Faster :)
Github User Rank List