承接 thanatos-vf-2000/vagrant-docker-wls2 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thanatos-vf-2000/vagrant-docker-wls2

最新稳定版本:v1.0.0

Composer 安装命令:

composer create-project thanatos-vf-2000/vagrant-docker-wls2

包简介

Exemple of Vagrant and Docker in WSL2.

README 文档

README

GitHub version

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Exemple of Vagrant and Docker in WSL2

Docker installation on WSL

Installing Docker in WSL

# Installation requirements
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

# Adding the Docker repo
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Adding the Docker repo key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# Docker installation
sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io

# Add the current user to the Docker group
sudo usermod -aG docker $USER

Update IPTables

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

Create /etc/profile.d/vagrant.sh

sudo vi /etc/profile.d/vagrant.sh

Add this line to file

#https://developer.hashicorp.com/vagrant/docs/other/wsl
export PATH="$PATH:/mnt/c/Windows/System32/WindowsPowerShell/v1.0"
export PATH="$PATH:/mnt/c/Windows/System32"
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"

change right to file Add this line to file

sudo chmod a+x /etc/profile.d/vagrant.sh
  • Under windows 11, you need to add these lines to /etc/wsl.conf

Edit file /etc/wsl.conf

sudo vi /etc/wsl.conf

Add this line

[boot]
command = "service docker start"

Run this command on cmd or powershell

wsl.exe --shutdown

Once the WSL machine is restarted, check that Docker is operational:

docker ps
  • Under Windows 10, you must add these lines to your .profile

Edit file .profile

vi ~/.profile

Add this lines and replace WSL_DISTRO_NAME1 by the image name

if service docker status 2>&1 | grep -q "is not running"; then
    wsl.exe -d "${WSL_DISTRO_NAME}" -u root -e /usr/sbin/service docker start >/dev/null 2>&1
fi

Run this command on cmd or powershell

wsl.exe --shutdown

Once the WSL machine is restarted, check that Docker is operational:

docker ps

Installation of Vagrant

Add repository and install

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vagrant

Restart WSL, run this command on cmd or powershell

wsl.exe --shutdown

Images

  • Ubuntu
    • 14.04 - trusty
    • 16.04 - xenial
    • 18.04 - bionic
    • 20.04 - focal
    • 22.04 - jammy
    • 22.10 - kinetic
  • Windows

Footnotes

  1. run in powershell commande wsl -l -v

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Dockerfile

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2022-11-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固