angelo-v / wordpress-backup

Simple Docker container that helps you backup and restore your WordPress blog.
80 stars 60 forks source link

environment variables not set #13

Closed felixsteghofer closed 8 years ago

felixsteghofer commented 8 years ago

Hi, thanks for your handy container! I encountered one issue.

The environment variables needed e.g. for restoring do not get set in my setup (pretty much like the readme, but mariadb instead of mysql)

If I manually set (in my docker-compose.yml)

MYSQL_ENV_MYSQL_USER: <WP-USER>
MYSQL_ENV_MYSQL_PASSWORD: <USER-PW>
MYSQL_ENV_MYSQL_DATABASE: <WP-DB>
MYSQL_PORT_3306_TCP_PORT: 3306

everything works fine.

I could not find where these environments should be generated from, so I can only guess this is some docker magic that I'm no yet aware of.

Any hint?

angelo-v commented 8 years ago

Those environment variables for the backup container are automatically generated when using a docker link.

Docker creates several environment variables when you link containers. Docker automatically creates environment variables in the target container based on the --link parameters. It will also expose all environment variables originating from Docker from the source container

Are you perhaps using compose file version 2?

Environment variables will only be populated if you’re using the legacy version 1 Compose file format. (https://docs.docker.com/compose/link-env-deprecated/)

Using a custom docker network instead of default docker0 bridge might also be a cause.

felixsteghofer commented 8 years ago

Actually a custom network is used but I don't think that is the issue here (as db, wordpress and backup are in the same network)

As my setup uses docker-composer v2 this is most likely the issue.

Thanks for clarifying that, maybe somebody else stumbles over it.

aleksander351 commented 6 years ago

I've got both, version 2 and custom network. Aaaarghh..

angelo-v commented 6 years ago

see angelo-v/wordpress-backup-quickstart for working docker compose examples