I want to develop frontend app in an isolated container. To set it up, I have followed Developing inside a Container document.
This is my project:
├── .dockerignore
├── .git
│ └── foo
├── .gitignore
├── .gitmodules
├── backend
│ ├── .devcontainer.json
│ ├── .git
│ │ └── foo
│ ├── .gitignore
│ ├── Dockerfile.development
│ ├── Dockerfile.production
│ └── foo
├── docker-compose.development.yml
├── docker-compose.production.yml
├── docker-sync.yml
├── frontend
│ ├── .devcontainer.json <- Trying to run dev container with this one.
│ ├── .dockerignore
│ ├── .git
│ │ └── foo
│ ├── .gitignore
│ ├── Dockerfile.development
│ ├── Dockerfile.production
│ ├── foo
└── └── yarn.lock
frontend/.devcontainer.json
{
"name": "chat-app_frontend",
"dockerComposeFile": ["../docker-compose.development.yml"],
"service": "frontend",
"shutdownAction": "none",
"extensions": ["dbaeumer.vscode-eslint"],
"workspaceFolder": "/app",
"settings": {
"git.path": "/usr/bin/git",
}
}
The problem is that the IDE tries to open git repository from wrong directory. As a result, while being connected to the Dev Container, IDE Git tools tell me the repository can't be found.
Output -> Git returns:
Opening repository for path='/app' failed; ex=Failed to execute git {
"exitCode": 128,
"gitErrorCode": "NotAGitRepository",
"gitCommand": "rev-parse",
"stdout": "",
"stderr": "fatal: not a git repository: /app/../.git/modules/chat-frontend\n"
I can see .git directory in the running container:
23baa3d3982d:/app# find .git
.git
