Skip to content

How can we open default folder in VSCode while running in container #1503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sanjayme97 opened this issue Apr 8, 2020 · 9 comments
Closed

Comments

@sanjayme97
Copy link

How can we open default folder in VSCode while running in container.
-v "$PWD:/home/coder/project" is not working how to give base-path @code-asher

@dntq83
Copy link

dntq83 commented Apr 8, 2020

I have the same issue, can't open project files

@code-asher
Copy link
Member

code-asher commented Apr 8, 2020

You can pass it on the command line. For example something like:

docker run -it -p 127.0.0.1:8080:8080 -v "$PWD:/home/coder/project" codercom/code-server /home/coder/project

Also check out https://github.com/cdr/code-server/blob/master/doc/FAQ.md#how-does-code-server-decide-what-workspace-or-folder-to-open

@sanjayme97
Copy link
Author

" -v "$PWD:/home/coder/project" this argument is not working for me.
"docker run -it -p 127.0.0.1:8080:8080 codercom/code-server /home/coder/project" this works fine for me. why you are using " -v "$PWD:/home/coder/project" ? @code-asher

@code-asher
Copy link
Member

code-asher commented Apr 9, 2020

That mounts your current directory into /home/coder/project in the Docker container. If you use that you should see the contents of that directory when you do ls /home/coder/project inside the Docker container.

You might want to mount your project instead of just using the current directory, for example -v /path/to/my/project:/home/coder/project. If you don't want to mount anything into the Docker container then you can skip this, but keep in mind if the Docker container shuts down the files will be lost.

@cstrat
Copy link

cstrat commented May 1, 2020

Also check out https://github.com/cdr/code-server/blob/master/doc/FAQ.md#how-does-code-server-decide-what-workspace-or-folder-to-open

Sorry for posting in this closed issue but I have a question and don't want to open a new issue.

Does anyone know if there is a way to open a workspace/folder from the terminal??
In the desktop version I believe you can run code /xxx/yyy/zzz.workspace...

Reason is I have an init script which I run after upgrading versions which re-installs node & my local tools and I want that to also just open the project workspace too.

@code-asher
Copy link
Member

Not yet but we want to add a way: #164

@code-asher
Copy link
Member

Er, that's assuming you want to open the folder/workspace in the existing code-server window. If that's not what you meant let me know.

@cstrat
Copy link

cstrat commented May 2, 2020

Oh that is exactly what I am asking. I did try search for similar issues but wasn't searching the right words. 👍

@vital987
Copy link

Starting code-server with the working directory as the last arguement,
eg: code-server --bind-addr 0.0.0.0:9870 /working/directory
This worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants