Trying to start Docker daemon in script.
Some checks reported errors
continuous-integration/drone/push Build was killed

Can possibly help with authorization problems.
This commit is contained in:
Stanislav Nikitin 2022-06-27 12:29:43 +05:00
parent a26adfc78b
commit 5dd146d2c0
Signed by: pztrn
GPG Key ID: 1E944A0F0568B550
2 changed files with 12 additions and 14 deletions

View File

@ -22,22 +22,10 @@ trigger:
branch: ["main"]
steps:
- name: "docker"
- name: "mirror"
image: "docker:20.10.17-dind"
pull: if-not-exists
detach: true
privileged: true
environment:
DOCKER_HOST: tcp://0.0.0.0:2375
DOCKER_TLS_CERTDIR: ""
commands:
- /usr/local/bin/dockerd --data-root=/var/lib/docker --host=tcp://0.0.0.0:2375 --tls=false
- name: "mirror"
image: "docker:20.10.17"
pull: if-not-exists
environment:
DOCKER_HOST: tcp://docker:2375
REGISTRY: code.pztrn.name
REGISTRY_USER: drone
REGISTRY_PASSWORD:

View File

@ -7,6 +7,17 @@ DESTINATION_PROJECT=${DESTINATION_REGISTRY}/containers/mirror
USER=${REGISTRY_USER}
PASSWORD=${REGISTRY_PASSWORD}
# Starting Docker daemon.
/usr/local/bin/dockerd --data-root=/var/lib/docker &
# Wait for it.
echo "Waiting for Docker daemon to start..."
while true; do
if docker ps &> /dev/null; then
break
fi
done
MIRROR_CONFIGS=$(ls ./images/*.sh)
# shellcheck disable=SC2068
for file in ${MIRROR_CONFIGS[@]}; do
@ -52,7 +63,6 @@ function mirror() {
# Login to registry.
echo "Logging into '${DESTINATION_REGISTRY}' as '${USER}'..."
docker login -u "${USER}" -p "${PASSWORD}" "${DESTINATION_REGISTRY}"
cat ~/.docker/config.json
# Mirror images.
for image in "${WHAT_TO_MIRROR[@]}"; do