Use container environment variable in docker run without using bash -c -
i have wp-cli container have run following command:
wp --allow-root core config --dbname=$mysql_database --dbuser=$mysql_user --dbpass=$mysql_password --dbhost=$wp_cli_mysql_host --debug
when run in bash inside container, have no problem, when try do:
docker-compose run --rm wordpress-cli --rm core config --dbname=$mysql_database --dbuser=$mysql_user --dbpass=$mysql_password --dbhost=$wp_cli_mysql_host --allow-root --debug
all environment variables evaluated in host instead of container, passed empty container.
i found in this question, using bash -c 'my command'
trick, entrypoint
wp command, want run without using bash
command.
just escape $
passed through container:
docker-compose run --rm wordpress-cli --rm core config --dbname=\$mysql_database --dbuser=\$mysql_user ...
Comments
Post a Comment