0

Is it possible from Docker to modify (Add) to the host file of the HOST operating system: Windows or its equivalent in Ubuntu and create the URL and IP address entries?

I hope to be able to add dynamically in the process of executing the command:

docker-compose up -d

Note:

127.0.0.1 www.lh-2.dock lh-2.dock
127.0.0.1 www.lh-2.pma.dock lh-2.pma.dock

Try:

version: '3'
services:
  myapp:
    image: image_app
    container_name: container_app
    volumes:
      - E:\Web\LH2\docker\hosts:C:\Windows\System32\drivers\etc\hosts
    command: cmd /c "echo 127.0.0.1 www.lh-2.dock lh-2.dock >> C:\Windows\System32\drivers\etc\hosts && echo 127.0.0.1 www.lh-2.pma.dock lh-2.pma.dock >> C:\Windows\System32\drivers\etc\hosts && your_start_command"

and

version: '3'
services:
  myapp:
    image: image_app
    container_name: container_app
    volumes:
      - /media/developer1/device/Web/LH2/docker/hosts:/etc/hosts
    command: sh -c "echo '127.0.0.1 www.lh-2.dock lh-2.dock' >> /etc/hosts && echo '127.0.0.1 www.lh-2.pma.dock lh-2.pma.dock' >> /etc/hosts && tu_comando_de_inicio"

How can I merge the two environments that were deployed on Windows/Linux and let the system select the appropriate environment?

New contributor
ArcanisGK507 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.