devcontainers / devcontainers/cli

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

Đang mở
#647 4 bình luận 0 reaction 1 người được giao Được @chrmarti nhận Xem trên GitHub
info-needed
Ngôn ngữ chính
TypeScript
Star
3k
Fork
457
Merge trung bình
13 giờ 17 phút
Pull request đã merge (30 ngày)
6

Mô tả

![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 :)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.