Skip to content
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

"variable is not set. Substituting a blank string." being shown when env variables from links used in directives #2123

Closed
shrikrishnaholla opened this issue Oct 1, 2015 · 9 comments · Fixed by #2204

Comments

@shrikrishnaholla
Copy link

I'm working with master (which is currently at dabf1e8), and while building or starting, I'm getting the above warning, and those commands won't work

Ex: I am using a service

rcli:
  image: redis:latest
  links:
    - redis
  command: >
     sh -c 'redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'

Here, since the env variable REDIS_PORT_6379_TCP_ADDR is obtained because of linking, and it's non-existent when building, or before starting the redis service, I can't use this service. It substitutes the value with an empty string.

The REDIS_PORT_6379_TCP_ADDR variable is not set. Substituting a blank string.
The REDIS_PORT_6379_TCP_PORT variable is not set. Substituting a blank string.
@shrikrishnaholla
Copy link
Author

This is also reproducible if the CMD directive in the Dockerfile uses any env variable

CMD fluentd --gemfile /etc/fluent/Gemfile -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_OPT

Seems like command string is being evaluated or something by compose or docker-py, and that is being done prematurely

@ghost
Copy link

ghost commented Oct 1, 2015

This is due #1377. For your case double $
On the other note
$REDIS_PORT_6379_TCP_ADDR - using those env is deprecated.

@dnephin
Copy link

dnephin commented Oct 1, 2015

I think maybe we should document this error explicitly, I suspect a few more people will hit this on release.

It should only apply to variables in the config though, not the Dockerfile.

@dnephin dnephin added this to the 1.5.0 milestone Oct 1, 2015
@shrikrishnaholla
Copy link
Author

@dnephin My bad. It's not hitting Dockerfile. I had replicated the command in the command section in docker-compose.yml, which was causing the error

@shrikrishnaholla
Copy link
Author

@villlem

$REDIS_PORT_6379_TCP_ADDR - using those env is deprecated.

What is the recommended way? I'm using whatever I read in the docs

@ghost
Copy link

ghost commented Oct 1, 2015

@shrikrishnaholla: Docker populate /etc/host inside container with names from link and also do not change ports. But documentation is confusing.

See https://docs.docker.com/compose/env/ for details.

I would just remove port and replace address with name from /etc/hosts

rcli:
  image: redis:latest
  links:
    - redis
  command: >
     sh -c 'redis-cli -h redis '

This should also works. I'm not on computer with docker right now

rcli:
  image: redis:latest
  links:
    - redis
  command: redis-cli -h redis

@shrikrishnaholla
Copy link
Author

Oh! Didn't know this. Thanks @villlem !

@chisumo2016
Copy link

C:\Users\bundalla\Desktop\advancelaravel54\laradock>docker-compose up -d nginx mysql
WARNING: The PMA_USER variable is not set. Defaulting to a blank string.
WARNING: The PMA_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The PMA_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The PMA_DB_ENGINE variable is not set. Defaulting to a blank string.
WARNING: The PMA_PORT variable is not set. Defaulting to a blank string.
WARNING: The DATA_SAVE_PATH variable is not set. Defaulting to a blank string.
WARNING: The DOCKER_HOST_IP variable is not set. Defaulting to a blank string.
WARNING: The PHP_IDE_CONFIG variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_XDEBUG variable is not set. Defaulting to a blank string.
WARNING: The INSTALL_BLACKFIRE variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_SOAP variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_MONGO variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_ZIP_ARCHIVE variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_BCMATH variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_PHPREDIS variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_MEMCACHED variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_OPCACHE variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_EXIF variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_AEROSPIKE_EXTENSION variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_MYSQLI variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_TOKENIZER variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_INTL variable is not set. Defaulting to a blank string.
WARNING: The PHP_FPM_INSTALL_GHOSTSCRIPT variable is not set. Defaulting to a blank string.
WARNING: The PHP_VERSION variable is not set. Defaulting to a blank string.
WARNING: The POSTGRES_DB variable is not set. Defaulting to a blank string.
WARNING: The POSTGRES_USER variable is not set. Defaulting to a blank string.
WARNING: The POSTGRES_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The POSTGRES_PORT variable is not set. Defaulting to a blank string.
WARNING: The HAPROXY_HOST_HTTP_PORT variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_DATABASE variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_USER variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_PORT variable is not set. Defaulting to a blank string.
WARNING: The BLACKFIRE_SERVER_ID variable is not set. Defaulting to a blank string.
WARNING: The BLACKFIRE_SERVER_TOKEN variable is not set. Defaulting to a blank string.
WARNING: The SELENIUM_PORT variable is not set. Defaulting to a blank string.
WARNING: The PHP_SOCKET variable is not set. Defaulting to a blank string.
WARNING: The APACHE_HOST_LOG_PATH variable is not set. Defaulting to a blank string.
WARNING: The APACHE_HOST_HTTP_PORT variable is not set. Defaulting to a blank string.
WARNING: The APACHE_HOST_HTTPS_PORT variable is not set. Defaulting to a blank string.
WARNING: The JENKINS_HOST_SLAVE_AGENT_PORT variable is not set. Defaulting to a blank string.
WARNING: The JENKINS_HOST_HTTP_PORT variable is not set. Defaulting to a blank string.
WARNING: The JENKINS_HOME variable is not set. Defaulting to a blank string.
WARNING: The MEMCACHED_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_CONFIG variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_PROXY2_CACHE_SIZE variable is not set. Defaulting to a blank string.
WARNING: The VARNISHD_PARAMS variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_PORT variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_PROXY2_BACKEND_HOST variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_BACKEND_PORT variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_PROXY2_SERVER variable is not set. Defaulting to a blank string.
WARNING: The NGINX_HOST_LOG_PATH variable is not set. Defaulting to a blank string.
WARNING: The NGINX_SITES_PATH variable is not set. Defaulting to a blank string.
WARNING: The NGINX_HOST_HTTP_PORT variable is not set. Defaulting to a blank string.
WARNING: The NGINX_HOST_HTTPS_PORT variable is not set. Defaulting to a blank string.
WARNING: The APPLICATION variable is not set. Defaulting to a blank string.
WARNING: The PERCONA_DATABASE variable is not set. Defaulting to a blank string.
WARNING: The PERCONA_USER variable is not set. Defaulting to a blank string.
WARNING: The PERCONA_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The PERCONA_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The PERCONA_PORT variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_PROXY1_CACHE_SIZE variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_PROXY1_BACKEND_HOST variable is not set. Defaulting to a blank string.
WARNING: The VARNISH_PROXY1_SERVER variable is not set. Defaulting to a blank string.
WARNING: The MARIADB_DATABASE variable is not set. Defaulting to a blank string.
WARNING: The MARIADB_USER variable is not set. Defaulting to a blank string.
WARNING: The MARIADB_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MARIADB_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MARIADB_PORT variable is not set. Defaulting to a blank string.
WARNING: The MSSQL_DATABASE variable is not set. Defaulting to a blank string.
WARNING: The MSSQL_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MSSQL_PORT variable is not set. Defaulting to a blank string.
WARNING: The MINIO_PORT variable is not set. Defaulting to a blank string.
WARNING: The RABBITMQ_DEFAULT_USER variable is not set. Defaulting to a blank string.
WARNING: The RABBITMQ_DEFAULT_PASS variable is not set. Defaulting to a blank string.
WARNING: The RABBITMQ_NODE_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The RABBITMQ_MANAGEMENT_HTTP_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The ADM_PORT variable is not set. Defaulting to a blank string.
WARNING: The ELASTICSEARCH_HOST_HTTP_PORT variable is not set. Defaulting to a blank string.
WARNING: The ELASTICSEARCH_HOST_TRANSPORT_PORT variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_XDEBUG variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_SOAP variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_MONGO variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_NODE variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_YARN variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_DRUSH variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_AEROSPIKE_EXTENSION variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_V8JS_EXTENSION variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_COMPOSER_GLOBAL_INSTALL variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_WORKSPACE_SSH variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_LARAVEL_ENVOY variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_DEPLOYER variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_LINUXBREW variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_INSTALL_MC variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_PUID variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_PGID variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_NODE_VERSION variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_YARN_VERSION variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_TIMEZONE variable is not set. Defaulting to a blank string.
WARNING: The BLACKFIRE_CLIENT_ID variable is not set. Defaulting to a blank string.
WARNING: The BLACKFIRE_CLIENT_TOKEN variable is not set. Defaulting to a blank string.
WARNING: The WORKSPACE_SSH_PORT variable is not set. Defaulting to a blank string.
WARNING: The BEANSTALKD_HOST_PORT variable is not set. Defaulting to a blank string.
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.proxy.expose is invalid: should be of the format 'PORT[/PROTOCOL]'
services.proxy2.expose is invalid: should be of the format 'PORT[/PROTOCOL]'
services.memcached.ports is invalid: Invalid port ":11211", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.beanstalkd.ports is invalid: Invalid port ":11300", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.mssql.ports is invalid: Invalid port ":1433", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.rabbitmq.ports is invalid: Invalid port ":15671", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.rabbitmq.ports is invalid: Invalid port ":15672", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.workspace.ports is invalid: Invalid port ":22", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.mariadb.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.mysql.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.percona.ports is invalid: Invalid port ":3306", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.apache2.ports is invalid: Invalid port ":443", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.nginx.ports is invalid: Invalid port ":443", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.selenium.ports is invalid: Invalid port ":4444", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.jenkins.ports is invalid: Invalid port ":50000", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.postgres.ports is invalid: Invalid port ":5432", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.postgres-postgis.ports is invalid: Invalid port ":5432", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.rabbitmq.ports is invalid: Invalid port ":5672", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.apache2.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.nginx.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.phpmyadmin.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.adminer.ports is invalid: Invalid port ":8080", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.jenkins.ports is invalid: Invalid port ":8080", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.balancer.ports is invalid: Invalid port ":8085", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.minio.ports is invalid: Invalid port ":9000", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.elasticsearch.ports is invalid: Invalid port ":9200", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.elasticsearch.ports is invalid: Invalid port ":9300", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]

@dnephin
Copy link

dnephin commented May 3, 2017

Please see https://docs.docker.com/compose/environment-variables/. Link environment variables would need to be escaped with $$, but they are also deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants