Skip to content
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

How to run postCreateCommand in another folder? #349

Closed
DanTup opened this issue May 17, 2019 · 4 comments
Closed

How to run postCreateCommand in another folder? #349

DanTup opened this issue May 17, 2019 · 4 comments
Assignees
Labels
containers Issue in vscode-remote containers *question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@DanTup
Copy link

DanTup commented May 17, 2019

Currently it seems like postCreateCommand always runs in the folder that was opened, but in the example containers the projects are all in subfolders named test-project. I tried doing this:

"postCreateCommand": ["cd test-project", "pub get"]

But it failed like this:

OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused "exec: \"cd test-project\": executable file not found in $PATH": unknown
postCreateCommand ["cd test-project","pub get"] failed.

Is there some way to do this? If not, would this be considered?

@Chuxel
Copy link
Member

Chuxel commented May 17, 2019

@DanTup You should be able to do this using a string as follows: "postCreateCommand": "cd test-project && pub get" (EDITED)

The array is for separated arguments of a single command. e.g. "postCreateCommand": ["cd", "test-project"]

We can clarify this better in docs looking at it.

@Chuxel
Copy link
Member

Chuxel commented May 17, 2019

Whoops! Cmd+Z'd myself into a bad example. Meant: "postCreateCommand": "cd test-project && pub get"

@DanTup
Copy link
Author

DanTup commented May 18, 2019

I tried that but it failed with the same message.

As it turned out, it probably wasn't a good place to do pub get, since this is project-specific, not container-specific. I was really trying it as a workaround until I get to fix Dart-Code/Dart-Code#1719 (the test-project folder being in a subfolder would prevent us noticing it needed packages fetching). With the simplified Dart container there aren't any dependencies now, so I was able to avoid it.

Though now I'm also wondering whether postCreateCommand differs much from just putting an extra RUN section at the bottom of the dockerfile?

@roblourens roblourens added the containers Issue in vscode-remote containers label May 19, 2019
@chrmarti
Copy link
Contributor

postCreateCommand can access the mounted folders while RUN cannot. Closing this for now, let us know when it becomes relevant again. (@Chuxel 's suggestion should work.)

@chrmarti chrmarti added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Jun 11, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers *question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants