Skip to content

Commit 7c8e5c1

Browse files
codiflowDerLinkman
andauthored
Add create command to prevent external: true warnings (#6203)
This is related to #5970 and https://community.mailcow.email/d/2126-backup-restore/2 It adds `docker compose create` to the script which gets executed directly after the sync of the mailcow-dockerized directory. This way the Docker daemon on the remote side creates everything and we get rid of the warning "volume "XYZ" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume" This is helpful if you use the create-cold-standby.sh script to migrate your mailcow installation to another server and don't want to get those warnings after migration. Co-authored-by: Niklas Meyer <[email protected]>
1 parent ed2837e commit 7c8e5c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

helper-scripts/_cold-standby.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,17 @@ if [ ${ec} -ne 0 ] && [ ${ec} -ne 24 ]; then
202202
exit 1
203203
fi
204204

205+
# Let the remote side create all network, volumes and containers to prevent need for external:true #
206+
echo -e "\e[33mCreating networks, volumes and containers on remote...\e[0m"
207+
208+
if ! ssh -o StrictHostKeyChecking=no \
209+
-i "${REMOTE_SSH_KEY}" \
210+
${REMOTE_SSH_HOST} \
211+
-p ${REMOTE_SSH_PORT} \
212+
${COMPOSE_COMMAND} -f "${SCRIPT_DIR}/../docker-compose.yml" create 2>&1 ; then
213+
>&2 echo -e "\e[31m[ERR]\e[0m - Could not create networks, volumes and containers on remote"
214+
fi
215+
205216
# Trigger a Redis save for a consistent Redis copy
206217
echo -ne "\033[1mRunning redis-cli save... \033[0m"
207218
docker exec $(docker ps -qf name=redis-mailcow) redis-cli -a ${REDISPASS} --no-auth-warning save
@@ -326,4 +337,4 @@ if ! ssh -o StrictHostKeyChecking=no \
326337
>&2 echo -e "\e[31m[ERR]\e[0m - Could not cleanup old images on remote"
327338
fi
328339

329-
echo -e "\e[32mDone\e[0m"
340+
echo -e "\e[32mDone\e[0m"

0 commit comments

Comments
 (0)