merll / docker-fabric

Integration of Docker deployments into Fabric.
MIT License
79 stars 10 forks source link

I cant configure environment variable to container #16

Open matef opened 7 years ago

matef commented 7 years ago

Hi, I'm trying to run a container that depends on some environment variables that I have to pass. I tried to add environment key like this but it seems not working.

env.docker_maps = ContainerMap('example_map', { 'repository': env.registry_prefix, 'host_root': env.host_root_path,
'excmd-service': { 'image': 'excmd:latest', 'instances': ('inst1'), 'environment': { 'MQ_IPADDRESS': env.app_mq_ip, 'DB_IPADDRESS': env.app_db_ip, 'MQ_TOPIC_NAME': env.MQ_TOPIC_NAME, 'DB_JOURNAL_KEYSPACE' : env.app_def_journal_kspace, 'DB_SNAPSHOT_KEYSPACE' : env.app_def_snapshot_kspace, },

},    

})

merll commented 7 years ago

environment is currently not supported directly on the container configuration, but can be added in create_options:

env.docker_maps = ContainerMap('example_map',
    repository=env.registry_prefix,
    host_root=env.host_root_path,
    containers={
        'excmd-service': {
            'image': 'excmd:latest',
            'instances': 'inst1',
            'create_options': {
                'environment': {
                    'MQ_IPADDRESS': env.app_mq_ip,
                    'DB_IPADDRESS': env.app_db_ip,
                    'MQ_TOPIC_NAME': env.MQ_TOPIC_NAME,
                    'DB_JOURNAL_KEYSPACE' : env.app_def_journal_kspace,
                    'DB_SNAPSHOT_KEYSPACE' : env.app_def_snapshot_kspace,
                },
            },
         },
    })