mirror of
https://github.com/yanhao98/docker-example.git
synced 2025-07-13 16:20:50 +08:00
Compare commits
59 Commits
v1.0.1-bet
...
main
Author | SHA1 | Date | |
---|---|---|---|
a699f12545 | |||
267ecbd641 | |||
d42920bfb2 | |||
d14ae3ad75 | |||
ba4d7e9993 | |||
9a4f51982e | |||
cae429b2a5 | |||
a856d689ba | |||
42c21810d9 | |||
f17df34f81 | |||
c3a7f000a9 | |||
64fb67731f | |||
c1a35e8a4c | |||
277031ada7 | |||
6b18d3acc2 | |||
297757ad5d | |||
c2558dfc0f | |||
2e76e5ea1f | |||
112daaf47c | |||
5e3e5a792c | |||
652424da7e | |||
8066155d32 | |||
58d72e0fbe | |||
78fcd1bc73 | |||
27271c2c30 | |||
44f9c3e5c3 | |||
b0e346d7e1 | |||
f1e7b67f88 | |||
21cfceb6c3 | |||
c2c1b14e42 | |||
68deddb351 | |||
c0eb66a472 | |||
061a6912b8 | |||
49060ce042 | |||
dbd4893e91 | |||
68083cb070 | |||
88aa77a36e | |||
ab16ce3d98 | |||
945c035391 | |||
44051e45ea | |||
cb2afc4854 | |||
50e55f549c | |||
85567fc3b3 | |||
e6ff3fbce8 | |||
1b1c42d07b | |||
475c19a782 | |||
f80a7fb8fb | |||
1b31d0264b | |||
84819b3e24 | |||
2d1e6c19b4 | |||
b7df52a2b0 | |||
d5565358e3 | |||
553d415123 | |||
5a3522f16e | |||
39b732b10f | |||
9b1be9863c | |||
366f1206ed | |||
bb62a67cb2 | |||
1663c90c95 |
69
.gitea/workflows/release-tag.yaml
Normal file
69
.gitea/workflows/release-tag.yaml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
name: Release Tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE_NAME: murielmay67761/docker-example
|
||||||
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
DOCKER_LATEST: latest
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker.io
|
||||||
|
username: ${{ env.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ env.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
docker.io/${{ env.DOCKER_IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.DOCKER_LATEST }}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||||
|
|
||||||
|
- name: Print metadata
|
||||||
|
run: |
|
||||||
|
echo "tags: ${{ steps.meta.outputs.tags }}"
|
||||||
|
echo "labels: ${{ steps.meta.outputs.labels }}"
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
89
.github/workflows/build-docker-image.yaml
vendored
89
.github/workflows/build-docker-image.yaml
vendored
@ -1,89 +0,0 @@
|
|||||||
name: Build Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_IMAGE_NAME: yanhao98/docker-example
|
|
||||||
GHCR_IMAGE_NAME: ${{ github.repository }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GHCR_USERNAME: ${{ github.repository_owner }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# - name: Login to DockerHub
|
|
||||||
# uses: docker/login-action@v3
|
|
||||||
# with:
|
|
||||||
# registry: docker.io
|
|
||||||
# username: ${{ env.DOCKER_USERNAME }}
|
|
||||||
# password: ${{ env.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ env.GHCR_USERNAME }}
|
|
||||||
password: ${{ env.GHCR_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Cache Docker layers
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/tmp/.buildx-cache
|
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-buildx-
|
|
||||||
|
|
||||||
- name: Extract metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
# docker.io/${{ env.DOCKER_IMAGE_NAME }}
|
|
||||||
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
|
||||||
|
|
||||||
# type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
|
|
||||||
# type=schedule,pattern={{date 'YYYYMMDD-HHmmss' tz='UTC'}}
|
|
||||||
# type=ref,event=branch
|
|
||||||
# type=ref,event=pr
|
|
||||||
# type=semver,pattern={{version}}
|
|
||||||
# type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
|
||||||
# type=sha
|
|
||||||
|
|
||||||
- name: Print metadata
|
|
||||||
run: |
|
|
||||||
echo "tags: ${{ steps.meta.outputs.tags }}"
|
|
||||||
echo "labels: ${{ steps.meta.outputs.labels }}"
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64, linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
file: ./Dockerfile
|
|
||||||
# cache-from: type=gha
|
|
||||||
# cache-to: type=gha,mode=max
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
62
.github/workflows/release-nightly.yaml
vendored
Normal file
62
.github/workflows/release-nightly.yaml
vendored
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# https://gitea.com/gitea/act_runner/src/commit/0e2a3e00f5b32d5407f4f929a1ae61d3df825362/.gitea/workflows/release-nightly.yml
|
||||||
|
name: Release Nightly
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
GHCR_IMAGE_NAME: ${{ github.repository }}
|
||||||
|
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GHCR_USERNAME: ${{ github.repository_owner }}
|
||||||
|
DOCKER_LATEST: nightly
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ env.GHCR_USERNAME }}
|
||||||
|
password: ${{ env.GHCR_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.DOCKER_LATEST }}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||||
|
|
||||||
|
- name: Print metadata
|
||||||
|
run: |
|
||||||
|
echo "tags: ${{ steps.meta.outputs.tags }}"
|
||||||
|
echo "labels: ${{ steps.meta.outputs.labels }}"
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
37
README.md
37
README.md
@ -1 +1,38 @@
|
|||||||
# docker-example
|
# docker-example
|
||||||
|
|
||||||
|
## [Play With Docker](http://labs.play-with-docker.com/)[^1]
|
||||||
|
|
||||||
|
[](http://play-with-docker.com?stack=https://raw.githubusercontent.com/yanhao98/docker-example/refs/heads/main/stacks/sything/docker-compose-pwd.yml)
|
||||||
|
> Click the *CLOSE* button, Replace the $IP with the given one on the top side, then run:
|
||||||
|
> `curl -x "socks5h://$IP:9091" -fsSL "https://www.cloudflare.com/cdn-cgi/trace"`
|
||||||
|
> ```
|
||||||
|
> docker run -it --entrypoint sing-box monius/docker-warp-socks:latest version
|
||||||
|
> ```
|
||||||
|
|
||||||
|
ssh 需要加参数` -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa`
|
||||||
|
```bash
|
||||||
|
ssh ip172-18-0-122-cs6efd291nsg0094ibog@direct.labs.play-with-docker.com -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [multiarch/qemu-user-static](https://github.com/multiarch/qemu-user-static)
|
||||||
|
```bash
|
||||||
|
docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||||
|
# type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
|
# type=schedule,pattern={{date 'YYYYMMDD-HHmmss' tz='UTC'}}
|
||||||
|
# type=ref,event=branch
|
||||||
|
# type=ref,event=pr
|
||||||
|
# type=semver,pattern={{version}}
|
||||||
|
# type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||||
|
# type=sha
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
[^1]: [play-with-docker/play-with-docker](https://github.com/play-with-docker/play-with-docker )
|
||||||
|
57
compose/duplicati/README.md
Normal file
57
compose/duplicati/README.md
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Duplicati
|
||||||
|
- https://github.com/linuxserver/docker-duplicati
|
||||||
|
- https://github.com/duplicati/duplicati/blob/master/ReleaseBuilder/Resources/Docker/README.md
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -it --entrypoint bash duplicati/duplicati:canary
|
||||||
|
/opt/duplicati/duplicati-cli help
|
||||||
|
```
|
||||||
|
|
||||||
|
## 启动
|
||||||
|
```bash
|
||||||
|
DUPLICATI_DOMAIN=❗️❗️❗️
|
||||||
|
DUPLICATI_PASSWORD=❗️❗️❗️
|
||||||
|
docker run -d -p 8500:8200 --restart unless-stopped --name duplicati_canary \
|
||||||
|
-v duplicati-data:/data \
|
||||||
|
--mount type=bind,source=~/_docker-stacks,target/_docker-stacks \
|
||||||
|
-e "TZ=Asia/Shanghai" \
|
||||||
|
-e "DUPLICATI__WEBSERVICE_ALLOWED_HOSTNAMES=$DUPLICATI_DOMAIN" \
|
||||||
|
-e "DUPLICATI__WEBSERVICE_PASSWORD=$DUPLICATI_PASSWORD" \
|
||||||
|
duplicati/duplicati:canary
|
||||||
|
docker logs -f duplicati_canary
|
||||||
|
```
|
||||||
|
|
||||||
|
## 访问
|
||||||
|
```bash
|
||||||
|
DUPLICATI_DOMAIN=$(docker inspect duplicati_canary | grep DUPLICATI__WEBSERVICE_ALLOWED_HOSTNAMES | awk -F '=' '{gsub(/",$/, "", $2); print $2}');
|
||||||
|
DUPLICATI_PASSWORD=$(docker inspect duplicati_canary | grep DUPLICATI__WEBSERVICE_PASSWORD | awk -F '=' '{gsub(/",$/, "", $2); print $2}');
|
||||||
|
URL="$DUPLICATI_DOMAIN:8500/login.html?password=$DUPLICATI_PASSWORD";
|
||||||
|
echo "🌐http://"
|
||||||
|
echo "$URL";
|
||||||
|
echo "🌐";
|
||||||
|
```
|
||||||
|
|
||||||
|
## 配置
|
||||||
|
|
||||||
|
`:8500/ngax/index.html#/settings`
|
||||||
|
|
||||||
|
```ini
|
||||||
|
--machine-id=⚠️
|
||||||
|
|
||||||
|
--send-mail-url=smtps://smtp.resend.com:2465
|
||||||
|
--send-mail-username=resend
|
||||||
|
--send-mail-password=⚠️
|
||||||
|
--send-mail-from=Duplicati <notifications@⚠️>
|
||||||
|
--send-mail-to=⚠️
|
||||||
|
--send-mail-level=Warning,Error,Fatal
|
||||||
|
--send-mail-any-operation=true
|
||||||
|
--send-mail-subject=%OPERATIONNAME% 👉🏻%PARSEDRESULT%👈🏻 for %backup-name%
|
||||||
|
--send-mail-body=%RESULT%
|
||||||
|
|
||||||
|
--send-http-url=
|
||||||
|
--send-http-result-output-format=Json
|
||||||
|
```
|
||||||
|
|
||||||
|
## Remote access control
|
||||||
|
|
||||||
|
https://app.duplicati.com/app/dashboard
|
86
compose/unicloud-unison/README.md
Normal file
86
compose/unicloud-unison/README.md
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# [unicloud](https://github.com/agarbato/unicloud) is a web interface to unison.
|
||||||
|
|
||||||
|
[play-with-docker.md](./play-with-docker.md)
|
||||||
|
|
||||||
|
## Server
|
||||||
|
|
||||||
|
### 启动服务端
|
||||||
|
```bash
|
||||||
|
mkdir -p /unison-unicloud-server/data /unison-unicloud-server/shares
|
||||||
|
chown -R 0:0 /unison-unicloud-server/data
|
||||||
|
chmod 777 /unison-unicloud-server/shares
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
SSH_PORT=2222
|
||||||
|
HTTP_PORT=5001
|
||||||
|
SERVER_UI_PASSWORD=
|
||||||
|
|
||||||
|
docker run -d --restart unless-stopped --name unison-unicloud-server \
|
||||||
|
--hostname unison-unicloud-server.oo1.dev \
|
||||||
|
-p $SSH_PORT:22 -p $HTTP_PORT:80 \
|
||||||
|
-e TZ=Asia/Shanghai \
|
||||||
|
-e USER=root -e USER_UID=0 \
|
||||||
|
-e SERVER_UI_USERNAME=unison-unicloud-admin \
|
||||||
|
-e SERVER_UI_PASSWORD=$SERVER_UI_PASSWORD \
|
||||||
|
-e ROLE=SERVER \
|
||||||
|
--mount type=bind,source=/unison-unicloud-server/data,target=/data \
|
||||||
|
--mount type=bind,source=/unison-unicloud-server/shares,target=/shares \
|
||||||
|
ghcr.io/yanhao98/unicloud:latest
|
||||||
|
docker logs -f unison-unicloud-server
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 查看密码
|
||||||
|
```bash
|
||||||
|
docker inspect unison-unicloud-server | grep -A 1 -B 1 -i password
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Client
|
||||||
|
```bash
|
||||||
|
curl https://unison-unicloud-server.oo1.dev/status -v
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p /unison-unicloud-client/data
|
||||||
|
# chown -R 1000:1000 /unison-unicloud-client/data
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
CLIENT_HOSTNAME=服务器主机名
|
||||||
|
SERVER_SHARE=share1 # 需要在服务器上先创建
|
||||||
|
SOURCE1=/path/to/backup1
|
||||||
|
SERVER_PORT=2222
|
||||||
|
|
||||||
|
docker run -d --name unison-unicloud-client \
|
||||||
|
-e SHARE_IGNORE="mysql.sock|.unison" \
|
||||||
|
-e UNISON_PARAMS="group=true|owner=true|times=true" \
|
||||||
|
-e TZ=Asia/Shanghai \
|
||||||
|
-e USER=root -e USER_UID=0 \
|
||||||
|
--restart on-failure \
|
||||||
|
-e CLIENT_HOSTNAME=$CLIENT_HOSTNAME \
|
||||||
|
-e ROLE=CLIENT \
|
||||||
|
-e SERVER_HOSTNAME=unison-unicloud-server.oo1.dev \
|
||||||
|
-e SERVER_PORT=$SERVER_PORT \
|
||||||
|
-e SERVER_SHARE=$SERVER_SHARE \
|
||||||
|
-e API_PROTOCOL=https \
|
||||||
|
-e API_PORT=443 \
|
||||||
|
-e SYNC_INTERVAL=60 \
|
||||||
|
--mount type=bind,source=/unison-unicloud-client/data,target=/data \
|
||||||
|
-e CLIENT_DEST=/share \
|
||||||
|
--mount type=bind,source=$SOURCE1,target="/share$SOURCE1" \
|
||||||
|
ghcr.io/yanhao98/unicloud:latest
|
||||||
|
docker logs -f unison-unicloud-client
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec -it unison-unicloud-client tail -f /data/log/client.log
|
||||||
|
docker exec -it unison-unicloud-client tail -f /data/log/supervisord.log
|
||||||
|
docker exec -it unison-unicloud-client tail -f /data/log/unicloud-supervise-err.log
|
||||||
|
docker exec -it unison-unicloud-client tail -f /data/log/unicloud-supervise-std.log
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec -e HOME=/data -it unison-unicloud-client unison unicloud
|
||||||
|
```
|
94
compose/unicloud-unison/play-with-docker.md
Normal file
94
compose/unicloud-unison/play-with-docker.md
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
# unicloud
|
||||||
|
[Unison](https://github.com/bcpierce00/unison/wiki/Software-for-use-with-Unison#web-interfaces) file sync web interface
|
||||||
|
|
||||||
|
[examples/client_server_replica/docker-compose.yml](https://github.com/agarbato/unicloud/blob/8e767790ada4d5c8c04dce0e06ebb3fa4a3a82a8/examples/client_server_replica/docker-compose.yml)
|
||||||
|
|
||||||
|
## 准备
|
||||||
|
1. 进入 https://labs.play-with-docker.com
|
||||||
|
2. Add new instance 两个
|
||||||
|
3. docker pull agarbato1/unison-unicloud:2.53.4
|
||||||
|
|
||||||
|
## Server
|
||||||
|
|
||||||
|
### 启动服务
|
||||||
|
```bash
|
||||||
|
mkdir -p /unison-unicloud/data /unison-unicloud/shares
|
||||||
|
chown -R 1000:1000 /unison-unicloud/data
|
||||||
|
chmod 777 /unison-unicloud/shares
|
||||||
|
docker run -d --name unison-unicloud-server \
|
||||||
|
-e TZ=Asia/Shanghai \
|
||||||
|
--network host \
|
||||||
|
-e SERVER_DEBUG=True \
|
||||||
|
-e SERVER_UI_USERNAME=admin \
|
||||||
|
-e SERVER_UI_PASSWORD= \
|
||||||
|
-e ROLE=SERVER \
|
||||||
|
--mount type=bind,source=/unison-unicloud/data,target=/data \
|
||||||
|
--mount type=bind,source=/unison-unicloud/shares,target=/shares \
|
||||||
|
agarbato1/unison-unicloud:2.53.4 \
|
||||||
|
bash -c "echo 'Port 2222' >> /etc/sshd_config_debug && exec python3 -u start.py"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>检查连接和配置</summary>
|
||||||
|
|
||||||
|
#### 检查是否能ping通client
|
||||||
|
```bash
|
||||||
|
CLIENT_IP="192.168.0.17"
|
||||||
|
docker exec -it server ping -c 1 $CLIENT_IP
|
||||||
|
```
|
||||||
|
#### 检查sshd配置
|
||||||
|
```bash
|
||||||
|
docker exec -it server cat /etc/sshd_config_debug
|
||||||
|
```
|
||||||
|
#### 查看sshd日志
|
||||||
|
```bash
|
||||||
|
cat ~/data/log/sshd.log
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
### 添加 share1
|
||||||
|
- 在`labs`点`Open Port`打开 80 端口
|
||||||
|
- 跳转后打开 http://ip172-18-0-23-csabksol2o90009mnang-80.direct.labs.play-with-docker.com`/shares`
|
||||||
|
- `Create Folder`选`No`
|
||||||
|
|
||||||
|
|
||||||
|
## Client
|
||||||
|
```bash
|
||||||
|
curl 192.168.0.18:80/status -v
|
||||||
|
|
||||||
|
mkdir -p /unison-unicloud/data /unison-unicloud/share
|
||||||
|
chown -R 1000:1000 /unison-unicloud/data
|
||||||
|
docker run -d --name unison-unicloud-client \
|
||||||
|
-e TZ=Asia/Shanghai \
|
||||||
|
--restart on-failure \
|
||||||
|
--network host \
|
||||||
|
-e CLIENT_HOSTNAME=client_hostname1 \
|
||||||
|
-e ROLE=CLIENT \
|
||||||
|
-e SERVER_HOSTNAME=192.168.0.18 \
|
||||||
|
-e SERVER_PORT=2222 \
|
||||||
|
-e SERVER_SHARE=share1 \
|
||||||
|
-e API_PROTOCOL=http \
|
||||||
|
-e API_PORT=80 \
|
||||||
|
-e SYNC_INTERVAL=15 \
|
||||||
|
--mount type=bind,source=/unison-unicloud/data,target=/data \
|
||||||
|
-e CLIENT_DEST=/share \
|
||||||
|
--mount type=bind,source=/unison-unicloud/share,target=/share \
|
||||||
|
agarbato1/unison-unicloud:2.53.4
|
||||||
|
docker logs -f unison-unicloud-client
|
||||||
|
```
|
||||||
|
|
||||||
|
### 激活
|
||||||
|
|
||||||
|
进 http://ip172-18-0-23-csabksol2o90009mnang-80.direct.labs.play-with-docker.com/`clients`,点击`ACTIVATE`
|
||||||
|
|
||||||
|
|
||||||
|
## 测试同步
|
||||||
|
```
|
||||||
|
touch /unison-unicloud/share/$(date +%s).txt
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec -it server ls /shares/share1
|
||||||
|
```
|
1
use-dive/README.md
Normal file
1
use-dive/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- https://github.com/wagoodman/dive/blob/main/README.md#basic-features
|
1
use-slim/README.md
Normal file
1
use-slim/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- https://github.com/slimtoolkit/slim
|
Reference in New Issue
Block a user