[+] docker init
This commit is contained in:
parent
e72be89dc7
commit
7df7a0c0e0
22
README.md
22
README.md
@ -1,3 +1,20 @@
|
|||||||
|
#### 安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# apt + ntp
|
||||||
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
|
||||||
|
|
||||||
|
# docker-ce
|
||||||
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash
|
||||||
|
|
||||||
|
# 初始化全部
|
||||||
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-all.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 进入容器
|
#### 进入容器
|
||||||
```bash
|
```bash
|
||||||
docker compose run debian bash
|
docker compose run debian bash
|
||||||
@ -13,10 +30,7 @@ docker compose run debian ./init-apt.sh
|
|||||||
```bash
|
```bash
|
||||||
docker compose run ubuntu ./init-apt.sh
|
docker compose run ubuntu ./init-apt.sh
|
||||||
```
|
```
|
||||||
##### 直接运行
|
|
||||||
```bash
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
|
|
||||||
```
|
|
||||||
##### docker 容器中
|
##### docker 容器中
|
||||||
```bash
|
```bash
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
RUN --mount=type=cache,target=/var/cache/apt \
|
||||||
|
6
init-all.sh
Normal file
6
init-all.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# apt + ntp
|
||||||
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
|
||||||
|
# docker-ce
|
||||||
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash
|
26
init-docker.sh
Normal file
26
init-docker.sh
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
command_exists() {
|
||||||
|
command -v "$@" > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
if command_exists docker; then
|
||||||
|
cat >&2 <<-'EOF'
|
||||||
|
docker 已安装.... 跳过
|
||||||
|
EOF
|
||||||
|
( set -x; sleep 20 )
|
||||||
|
else
|
||||||
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/docker-install.sh | sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > /etc/docker/daemon.json <<EOF
|
||||||
|
{
|
||||||
|
"registry-mirrors": [
|
||||||
|
"https://docker.martin98.com",
|
||||||
|
"https://registry-docker.martin98.com",
|
||||||
|
"https://registry-dockerhub.hk.martin98.com"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo systemctl restart docker
|
Loading…
x
Reference in New Issue
Block a user