devcontainers / devcontainers/cli

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

未关闭
#647 4 条评论 0 个 reaction 已指派 1 人 已被 @chrmarti 认领 在 GitHub 查看
info-needed
主要语言
TypeScript
星标
3k
派生
457
平均合并
13 小时 17 分钟
30 天内合并 PR
6

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。