Reputation: 3772
I have a docker image which is based off node:12. This image, along with others, are brought up via a docker-composer.yml file. The issue I am having is that I am unable to add extra_hosts to the container. In my yml file - I've got the following
my-app:
image: <image_name>
container_name: <container_name>
extra_hosts:
- "somehost:162.242.195.82"
This appears to work with other containers but not ones based of node:12. Is this functionality not available to images based off node:12? Or am I doing something wrong?
Upvotes: 1
Views: 1233
Reputation: 3205
Potential workaround:
Create a Dockerfile which uses node:12
as your parent image and then write your host into the /etc/hosts
manually. Then update your compose setup to build from that Dockerfile.
As mentioned below, this is purely a hacky workaround. It may be worth trying the other node:12
distribution such as node:12-alpine
.
Upvotes: 0
Reputation: 789
Check the base image of the node:12
, you have other choices (Stretch, Alpine, Buster) https://hub.docker.com/_/node/
It is a very bad idea to alter the /etc/hosts
of an image manually and to build a new image with an altered /etc/hosts
containing specific infos.
Upvotes: 1