D
D
develop12020-03-07 12:50:15
Docker
develop1, 2020-03-07 12:50:15

Where is the error in docker run command?

Good afternoon!
There is a docker-compose.yml file, which I run docker-compose up and everything works without problems, but for some reason I can’t run the same instructions through docker run.
docker-compose.yml

version: '3'

services:
  weba:
    image:docker-nginx-proxy-example_weba
    expose:
      - 8081
    environment:
      - VIRTUAL_HOST=a.localhost

So I try to run through docker run, it does not happen properly because nginx does not give the page to a.localhost
sudo docker run --expose=8081 -e VIRTUAL_HOST=a.localhost docker-nginx-proxy-example_weba

Where am I making a mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2020-03-07
@develop1

expose does not forward ports to the host, so it's interesting which nginx you are knocking on :)
And the main significant difference: docker-compose also creates a default docker network in which it raises containers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question