参考
https://neko.lzc256.com/notes/9iyoemzakdft46f1
先安装docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
echo \
"deb [arch=$(dpkg --print-architecture)] https://mirrors.aliyun.com/docker-ce/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
整个文件docker-compose.yml
,内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
services:
blessingskin:
image: lzc256/blessingskin:6.0.2
container_name: blessingskin
restart: always
ports:
- 8080:80
volumes:
- ./storage:/app/storage
- ./app:/app
command:
- sh
- -c
- |
mkdir -p /app/storage/framework/sessions /app/storage/framework/views /app/storage/framework/cache
touch /app/storage/sqlite.db
chown -R www-data:www-data /app; chmod -R 700 /app
sed -i 's/;extension=pdo_mysql/extension=pdo_mysql/g' /usr/local/etc/php/php.ini-production
sed -i 's/;extension=mysqli/extension=mysqli/g' /usr/local/etc/php/php.ini-production
docker-php-entrypoint apache2-foreground
networks:
- blessingskin
mysqldb:
image: mysql:8.0.32
container_name: blessingskin-mysql
restart: always
environment:
- MYSQL_ROOT_PASSWORD=onlyForTestRoot
- MYSQL_USER=blessingskin
- MYSQL_PASSWORD=onlyForTest
- MYSQL_DATABASE=blessingskin
volumes:
- ./mysql:/var/lib/mysql
networks:
- blessingskin
networks:
blessingskin:
external: false
|
配置一下本地代理,因为被墙了
1
2
3
4
5
6
7
8
9
10
11
12
|
mkdir /etc/systemd/system/docker.service.d
vim /etc/systemd/system/docker.service.d/http-proxy.conf
写入如下内容
[Service]
Environment="HTTP_PROXY=http://192.168.26.1:7890"
vim /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment="HTTPS_PROXY=http://192.168.26.1:7890"
然后重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker
|
如果需要可以进入
1
|
docker exec -it 容器ID /bin/bash
|