Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/he426100/vscode-remote-containers
vscode容器开发环境
https://github.com/he426100/vscode-remote-containers
containers dev-containers docker remote-development remote-development-container vscode wsl
Last synced: about 4 hours ago
JSON representation
vscode容器开发环境
- Host: GitHub
- URL: https://github.com/he426100/vscode-remote-containers
- Owner: he426100
- License: other
- Created: 2021-12-11T23:52:41.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T04:00:23.000Z (4 months ago)
- Last Synced: 2024-07-23T06:26:53.366Z (4 months ago)
- Topics: containers, dev-containers, docker, remote-development, remote-development-container, vscode, wsl
- Language: Shell
- Homepage:
- Size: 71.3 KB
- Stars: 21
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vscode使用Remote-Containers实现docker-php开发环境
### 使用说明
1. wsl下git clone
2. 用vscode打开文件夹:vscode-remote-containers/php/
3. 按f1,选择 remote-containers: Open Folder in Container (Rebuild and Reopen in Container)### 安装扩展示例
```
# install event
# docker-php-source extract
sudo apt update
sudo apt install libevent-dev -y
pecl install event
docker-php-ext-enable event
```### 准备和问题
1. 安装好[wsl2](https://docs.microsoft.com/zh-cn/windows/wsl/)及[docker](https://docs.microsoft.com/zh-cn/windows/wsl/tutorials/wsl-containers)
2. `mkdir ~/git` 存放源代码,挂载到容器内/workspaces/git,实现容器销毁后保留代码
3. `mkdir -p /etc/apache2/sites-enabled`,存放apache站点配置,挂载到容器内/etc/apache2/sites-enabled,实现容器销毁后保存站点配置
4. 可能会出现Open in Container失败(构建镜像失败),多半是网络问题,把Proxifier开起来就行了
5. 更新npm不生效可以用`su node -c "npm install -g npm"`
6. xdebug和phpcs冲突需要设置`xdebug.start_with_request = trigger`,xdebug 3.3.2需要设置`xdebug.mode = debug`才能开启单步调试,其他调试问题看官方文档[https://xdebug.org/docs/](https://xdebug.org/docs/)### 其他
1. [wsl2自动启动服务并且自动更新hosts文件里的ip](https://my.oschina.net/u/2266306/blog/4561599)
2. [解决WSL2中Vmmem内存占用过大问题](https://my.oschina.net/u/2266306/blog/4680942)
3. [wsl2使用docker实现开机自启redis,mysql](https://my.oschina.net/u/2266306/blog/5354632)
4. [迁移wsl2到其他盘](https://github.com/pxlrbt/move-wsl)
5. [释放wsl2占用的磁盘空间](https://superuser.com/questions/1606213/how-do-i-get-back-unused-disk-space-from-ubuntu-on-wsl2)
6. [wsl2下一行命令设置 windows 代理](https://my.oschina.net/mrpzx001/blog/8510980)### 参考资料
> [适用于 Linux 的 Windows 子系统文档](https://docs.microsoft.com/zh-cn/windows/wsl/)
> [https://code.visualstudio.com/docs/remote/containers](https://code.visualstudio.com/docs/remote/containers)
> [https://code.visualstudio.com/docs/remote/devcontainerjson-reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference)
> [https://github.com/microsoft/vscode-dev-containers/blob/main/containers/php/](https://github.com/microsoft/vscode-dev-containers/blob/main/containers/php/)