0

i am currently running a container from a dockerfile that uses some arguments and ports.

My question is: Does docker-compose override the port that i expose in the dockerfile ?

FROM  microsoft/dotnet:2.1-aspnetcore-runtime AS build-env
WORKDIR /app
COPY ./publish .
ENTRYPOINT ["dotnet","Server.dll","arg1"]
EXPOSE 8202

Docker-compose

services:
  mp:
    image: mp
    build: ./mpserver
    ports:
      - 8202:8203   <-----lets say i change the left side in the dockerfile

In my situation compose can alter parameters inside the dockerfile(s)? (8202 in dockerfile and 8203 in compose)

Can i set parameters like the arguments of ENTRYPOINT in the compose that would get somehow injected in the dockerfile ? (in our case arg1)

Bercovici Adrian
  • 8,794
  • 17
  • 73
  • 152
  • 1
    Possible duplicate of [What is the difference between docker-compose ports vs expose](https://stackoverflow.com/questions/40801772/what-is-the-difference-between-docker-compose-ports-vs-expose) – David Maze Dec 09 '18 at 18:51
  • TL;DR: `EXPOSE` is mostly just documentation and you can publish whatever `ports:` you choose with whatever host mapping you want, regardless of whether what's mentioned in the Dockerfile. – David Maze Dec 09 '18 at 18:52

0 Answers0