I'm trying to inject a new mapping in my contained /ect/hosts, without luck so far.
This is my docker-compose file content:
version: '3.5'
services:
mix-portal-ui:
build:
context: ../mix-portal-ui
dockerfile: Dockerfile-base
container_name: mix-portal-ui
volumes:
- ./app:/home/webapp/app:cached
- ./scripts:/home/webapp/scripts:cached
extra_hosts:
- "entrd-artifactory: 10.28.18.18"
networks:
mix-network:
aliases:
- mixui
My Dockerfile-base content is:
FROM node:10.18.1-alpine
RUN cat /etc/hosts
RUN ls -ltr /etc/hosts
RUN echo "10.28.18.18 entrd-artifactory" >> /etc/hosts
RUN cat /etc/hosts
# Add standard user so that npm is not run as root.
RUN adduser -D webapp && apk add --no-cache git bash
USER webapp
ENV HOME /home/webapp
WORKDIR $HOME
# This will reuse the cache and save a significant amout of time
# Unless package.json has changed. In that case all the commands
# after this one will be re-run
ADD ./package.json $HOME/
ADD ./.npmrc $HOME/
RUN npm install --loglevel warn
# Now we're free to add any additional files, they won't trigger the
# npm install when they change.
ADD ./.babelrc $HOME/.babelrc
ADD ./.eslintrc $HOME/.eslintrc
ADD ./scripts $HOME/scripts/
# Run
CMD ["npm", "run", "dev"]
Nomatter what I've tried the /etc/hosts file doesn't get updated with the mapping : 10.28.18.18 entrd-artifactory. It feels like that hosts files is locked by something, although there are no errors being thrown when trying to alter it.
The build output is :
build mix-portal-ui
Building mix-portal-ui
Step 1/16 : FROM node:10.18.1-alpine
---> cb69d515e572
Step 2/16 : RUN cat /etc/hosts
---> Running in f7f5542ce95e
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 f7f5542ce95e
Removing intermediate container f7f5542ce95e
---> 1a7182675d98
Step 3/16 : RUN ls -ltr /etc/hosts
---> Running in 1c378471818b
-rw-r--r-- 1 root root 174 Jun 4 15:47 /etc/hosts
Removing intermediate container 1c378471818b
---> bad80dd1b854
Step 4/16 : RUN echo "10.28.18.18 entrd-artifactory" >> /etc/hosts
---> Running in 2008fbd0b8da
Removing intermediate container 2008fbd0b8da
---> 5d902c1a486f
Step 5/16 : RUN cat /etc/hosts
---> Running in 441310e8803a
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 441310e8803a
Removing intermediate container 441310e8803a
---> 1e4798b158f9
......
The docker-compose version i use is: [root@mixvm local-build-tools]# docker-compose version docker-compose version 1.22.0, build f46880f docker-py version: 3.5.0 CPython version: 3.7.3 OpenSSL version: OpenSSL 1.1.1c FIPS 28 May 2019
the docker version is : [root@mixvm local-build-tools]# docker -v Docker version 18.09.5, build e8ff056
Any idea what is going on here?
Thanks