devcontainers / devcontainers/cli

Home Directory appears after "Clone Repository in Container Volume..."

Open
#647 4 comments 0 reactions 1 assignee Claimed by @chrmarti View on GitHub
info-needed
Dominant language
TypeScript
Stars
3k
Forks
457
Avg merge
13h 17m
Merged PRs (30d)
6

Description

![image](https://github.com/devcontainers/cli/assets/25391699/4f39e209-955d-4d1e-98e2-0855c22f6575)

Everything seems to be working but after cloning this folder appears in /workspaces/utas-dev and I don't know what causes this.

This is my devcontainer.json:

```json
{
"name": "Utas PHP",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/utas-dev",
"customizations": {
"vscode": {
"settings": {
"php.suggest.basic": false
},
"extensions": [
"zobo.php-intellisense"
]
}
},
"portsAttributes": {
"8000": {
"label": "Application",
"onAutoForward": "notify"
},
"8081": {
"label": "Database",
"onAutoForward": "notify"
}
},
"postCreateCommand": "composer update"
}
```

with this docker-compose.yml:

```yaml
version: "3"

services:
app:
build: .
ports:
- "8000:80"
depends_on:
- "mysql.80"

mysql.80:
image: "mysql/mysql-server:8.0"
restart: unless-stopped
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: 'secret'
MYSQL_DATABASE: v261
MYSQL_USER: utas
MYSQL_PASSWORD: utas
ports:
- "8081:3306"

volumes:
db-data:
```

and this Dockerfile all in the .devcontainers folder:

```dockerfile
FROM php:8.1-apache

RUN apt-get update && apt-get install -y \
vim \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
git \
libzip-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) bcmath gd zip mysqli exif pdo pdo_mysql

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

ENV APACHE_DOCUMENT_ROOT /workspaces/utas-dev

RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN a2enmod rewrite

RUN useradd -ms /bin/bash utas

RUN mkdir -p $APACHE_DOCUMENT_ROOT
RUN chown -R utas:utas $APACHE_DOCUMENT_ROOT
```

Please help me in solving this as I am quite new to the whole dev containers world :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.