windwo11 下这么运用ubuntu 配置docker laradock 环境
卸载旧版本
旧版本的 Docker 称为
docker
或者 docker-engine
,使用以下命令卸载旧版本:sudo apt-get remove docker \
docker-engine \
docker.io
使用 APT 安装
由于
apt
源使用 HTTPS 以确保软件下载过程中不被篡改。因此,我们首先需要添加使用 HTTPS 传输的软件包以及 CA 证书。1.复制下面代码
sudo apt-get update
2.复制下面代码
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
鉴于国内网络问题,强烈建议使用国内源,官方源请在注释中查看。
为了确认所下载软件包的合法性,需要添加软件源的
GPG
密钥。curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
官方源
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
然后,我们需要向
sources.list
中添加 Docker 软件源echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
如果执行了上面的就不要执行这个 官方源
#$ echo \
#"deb [arch=amd64 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
安装 Docker
更新 apt 软件包缓存,并安装
docker-ce
:sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
在测试或开发环境中 Docker 官方为了简化安装流程,提供了一套便捷的安装脚本,Ubuntu 系统上可以使用这套脚本安装,另外可以通过
--mirror
选项使用国内源进行安装:若你想安装测试版的 Docker, 请从 test.docker.com 获取脚本
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
执行这个命令后,脚本就会自动的将一切准备工作做好,并且把 Docker 的稳定(stable)版本安装在系统中。
启动docker
sudo systemctl enable docker
sudo systemctl start docker
测试docker是否安装正确
docker run --rm hello-world
随后将laradock git clone到你喜欢的目录下
修改
APP_CODE_PATH_HOST=../wwwroot/
PHP_VERSION=8.0
# If you need to change the sources (i.e. to China), set CHANGE_SOURCE to true
CHANGE_SOURCE=true
# Set CHANGE_SOURCE and UBUNTU_SOURCE option if you want to change the Ubuntu system sources.list file.
UBUNTU_SOURCE=aliyun
WORKSPACE_NODE_VERSION=16.15.1 //改版本并非最终稳定版本具体去官方网站查看node的版本 http://nodejs.cn/ 填写左侧这个版本

REDIS_PORT=6379 //默认端口 无需修改
REDIS_PASSWORD=root //改密码自己修改成自己记得住的
随后在laradock目录下执行docker-compose up -d nginx redis mysql portainer mailhog