D
D
develop12020-03-06 20:30:09
Docker
develop1, 2020-03-06 20:30:09

How to forward a variable to a container?

Until today, I had no dealings with Docker, so I apologize if my question seems naive.

I want to achieve that every time the container is launched weba, a new value is generated HOST. I generate it via bash and save it in $HOST.

How to forward a variable to a container?

version: '3'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    ports:
      - 8080:80
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

  weba:
    build:
      context: web/a
    expose:
      - 8081
    environment:
      - VIRTUAL_HOST=${HOST}.localhost
    depends_on:
      - nginx-proxy


What command can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OxCom, 2020-03-06
@develop1

Environment variables in Compose. Example .
Use environment variables

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question