-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override entrypoint: can't run any command after "docker-entrypoint.sh mysqld" #312
Comments
No, it doesn't even know that the |
@yosifkit Ah, I see, thanks for clarification. I need a cron to run |
I'd probably just run a new mysql container that dumps to a volume mounted from the host and then have it upload to drive. I'd probably even want to have a specific user in the database that has access for dumping but not anything else. FROM mysql:8.0.1
# install any tools needed to upload to google drive
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates wget \
&& rm -rf /var/lib/apt/lists/*
# make sure file is chmod +x locally
COPY backup-mysql.sh /usr/local/bin/
CMD ["backup-mysql.sh"] #!/bin/bash
set -e
slqFile="$(date +%Y-%m-%d).sql.gz"
# or maybe a file with the password via docker secrets
mysqldump -hmysql -ubackup -p"$SQL_PASSWORD" --all-databases | gzip -c > "/backup/$sqlFile"
# upload to google drive
#wget ... And then run it from cron or as a docker service that restarts on any exit with a delay of 23 or 24 hours. $ docker run --rm -v /path/to/local/backups/:/backup/ -e SQL_PASSWORD=secret --link name-of-msyql-container:mysql mysql-backup |
Version:
8.0.1
.I need to override entrypoint to be able to launch cron service, but at the same time I want to preserve existing entrypoint instruction. So I tried different options, and the last thing I did was:
Container launched, mysql was running, but cron service didn't launch. If I swap command places, everything works as expected:
Does
docker-entrypoint.sh
somehow strips&&
part? Is that possible for shell script to do such things? I am not a linux expert, just curious.The text was updated successfully, but these errors were encountered: