This is my Dockerfile.
FROM ubuntu:devel
MAINTAINER ciasto
RUN apt-get update && apt-get install -y apache2 && apt-get clean && rm -rf /var/lib/apt/lists/\*
RUN mkdir /var/run/apache2
COPY mysite.conf /etc/apache2/sites-available/000-default.conf
ENV APACHE\_RUN\_USER www-data
ENV APACHE\_RUN\_GROUP www-data
ENV APACHE\_LOG\_DIR /var/log/apache2
ENV APACHE\_RUN\_DIR /var/run/apache2
EXPOSE 80
CMD \["/usr/sbin/apache2", "-D", "FOREGROUND"\]
I am trying to load my site instead of default 000-default.conf but even though the mysite.conf overwrites 000-default.conf I still keep getting the default homepage of Apache instead.
It doesn't have any affect of a2dissite and then running a2ensite:
# docker build -t myapache .
Sending build context to Docker daemon 3.072kB
Step 1/13 : FROM ubuntu:devel
---> 3dd27c0da934
Step 2/13 : MAINTAINER ciasto
---> Using cache
---> ca48c7010bf5
Step 3/13 : RUN apt-get update && apt-get install -y apache2 && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 3893438f7d96
Step 4/13 : RUN mkdir /var/run/apache2
---> Using cache
---> 6cc65fe8d352
Step 5/13 : COPY mysite.conf /etc/apache2/sites-available/000-default.conf
---> Using cache
---> 469c402f7c57
Step 6/13 : RUN a2dissite 000-default
---> Running in 2de611818fc0
Site 000-default disabled.
To activate the new configuration, you need to run:
service apache2 reload
Removing intermediate container 2de611818fc0
---> 64d8deed8833
Step 7/13 : RUN a2ensite 000-default
---> Running in cc8a0374ab0d
Enabling site 000-default.
To activate the new configuration, you need to run:
service apache2 reload
Removing intermediate container cc8a0374ab0d
---> 3af0de88b74b
Step 8/13 : ENV APACHE_RUN_USER www-data
---> Running in fa2146657f5f
Removing intermediate container fa2146657f5f
---> dac302f42282
Step 9/13 : ENV APACHE_RUN_GROUP www-data
---> Running in 7a3035b5866d
Removing intermediate container 7a3035b5866d
---> fdfc7a1d86e4
Step 10/13 : ENV APACHE_LOG_DIR /var/log/apache2
---> Running in 93cc22c81f55
Removing intermediate container 93cc22c81f55
---> d8e073243eed
Step 11/13 : ENV APACHE_RUN_DIR /var/run/apache2
---> Running in ca2b2829d60c
Removing intermediate container ca2b2829d60c
---> c7f535e2c031
Step 12/13 : EXPOSE 80
---> Running in 613564334e15
Removing intermediate container 613564334e15
---> adae0f0e2aed
Step 13/13 : CMD ["apachectl", "-D", "FOREGROUND"]
---> Running in 97c845feed9f
Removing intermediate container 97c845feed9f
---> 67f7823b995b
Successfully built 67f7823b995b
Successfully tagged myapache:latest
then I still get default page of Apache and checked by entering running container:
# apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
This should fix your problem here. To be add after the COPY:
RUN a2dissite 000-default
RUN a2ensite 000-default
Related
I can't start nginx in docker.
My Dockerfile:
FROM ubuntu
RUN apt-get install -y nginx
RUN useradd nginx
ADD nginx.conf /etc/nginx/
COPY conf.d/ /etc/nginx/conf.d
COPY vladislav.crt /etc/nginx/vladislav.crt
COPY vladislav.csr /etc/nginx/vladislav.csr
COPY vladislav.key /etc/nginx/vladislav.key
COPY dhparam.pem /etc/nginx/dhparam.pem
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
I just build my image using next command
docker build -t custom_nginx .
docker run --name nginx_test custom_nginx
Where is my mistake?
#vijay
Sending build context to Docker daemon 73.22kB
Step 1/12 : FROM ubuntu:16.04
---> 77be327e4b63
Step 2/12 : RUN apt update
---> Using cache
---> 4fb44426c756
Step 3/12 : RUN apt-get install -y nginx
---> Using cache
---> 005b9faefee0
Step 4/12 : RUN useradd nginx
---> Using cache
---> b60713d5cce3
Step 5/12 : ADD nginx.conf /etc/nginx/
---> Using cache
---> a18a25afa878
Step 6/12 : COPY conf.d/ /etc/nginx/conf.d
---> Using cache
---> b1245c3f352d
Step 7/12 : COPY vladislav.crt /etc/nginx/vladislav.crt
---> Using cache
---> 5cc3e278e8fc
Step 8/12 : COPY vladislav.csr /etc/nginx/vladislav.csr
---> Using cache
---> e2d6824575a5
Step 9/12 : COPY vladislav.key /etc/nginx/vladislav.key
---> Using cache
---> ba28e5f7434b
Step 10/12 : COPY dhparam.pem /etc/nginx/dhparam.pem
---> Using cache
---> f6e3e5c5f3d1
Step 11/12 : EXPOSE 80 443
---> Using cache
---> bd10f8b63f23
Step 12/12 : CMD ["nginx", "-g", "daemon off;"]
---> Using cache
---> 0ac3851b312d
Successfully built 0ac3851b312d
Successfully tagged custom_nginx:latest
after that when I run it by that
root#maksym-X302UA:/etc/nginx# docker run --name nginx_test custom_nginx
I get only empty string
I am new in Docker, I am trying to create Flink docker image. Docker image is showing created successfully. But I have a doubt, I can not see Flink binaries in /opt path as mentioned in Dockerfile.
How do I know my Flink Docker image is created successfully.
Screenshot from console, few set of commands are highlighted in red color, means is it OK ?
Status showing Flink Docker image is created:
Please help me. Thank you....
Full Log:
sudo /home/develk/cntx_eng/build.sh \
> --job-artifacts /home/develk/cntx_eng/FlinkContextEnginePoc-0.0.1-SNAPSHOT.jar \
> --from-archive /home/develk/cntx_eng/flink-1.4.0-bin-hadoop24-scala_2.11.tgz \
> --image-name contxeng-flink-poc:1.4.0
--job-artifacts
/home/develk/cntx_eng/FlinkContextEnginePoc-0.0.1-SNAPSHOT.jar
--from-archive
JOB_ARTIFACTS_PATH : /home/develk/cntx_eng/FlinkContextEnginePoc-0.0.1-SNAPSHOT.jar
FROM_ARCHIVE : /home/develk/cntx_eng/flink-1.4.0-bin-hadoop24-scala_2.11.tgz
HADOOP_VERSION :
FLINK_VERSION :
-------------------------Arg Values---------------------------
FLINK_DIST : _TMP_/flink.tgz
JOB_ARTIFACTS_TARGET : _TMP_/artifacts
SHADED_HADOOP :
IMAGE_NAME : contxeng-flink-poc:1.4.0
--------------------------------------------------------------
Sending build context to Docker daemon 606.6MB
Step 1/23 : FROM openjdk:8-jre-alpine
---> f7a292bbb70c
Step 2/23 : RUN apk add --no-cache bash snappy libc6-compat
---> Using cache
---> 9e84497f3616
Step 3/23 : ENV FLINK_INSTALL_PATH=/opt
---> Using cache
---> 87bc358ccf00
Step 4/23 : ENV FLINK_HOME $FLINK_INSTALL_PATH/flink
---> Using cache
---> 712ba8d54555
Step 5/23 : ENV FLINK_LIB_DIR $FLINK_HOME/lib
---> Using cache
---> 80e7b085252e
Step 6/23 : ENV FLINK_PLUGINS_DIR $FLINK_HOME/plugins
---> Using cache
---> 7d39101e47d3
Step 7/23 : ENV FLINK_OPT_DIR $FLINK_HOME/opt
---> Using cache
---> 9bff7fc7145d
Step 8/23 : ENV FLINK_JOB_ARTIFACTS_DIR $FLINK_INSTALL_PATH/artifacts
---> Using cache
---> b0c01f3aab84
Step 9/23 : ENV FLINK_USR_LIB_DIR $FLINK_HOME/usrlib
---> Using cache
---> f4236bc26cab
Step 10/23 : ENV PATH $PATH:$FLINK_HOME/bin
---> Using cache
---> 2cb7cd442b6f
Step 11/23 : ARG flink_dist=NOT_SET
---> Using cache
---> 1a6fc691baa2
Step 12/23 : ARG job_artifacts=NOT_SET
---> Using cache
---> e11400e03120
Step 13/23 : ARG python_version=NOT_SET
---> Using cache
---> 313089fd991e
Step 14/23 : ARG hadoop_jar=NOT_SET*
---> Using cache
---> ccbef4dfa806
Step 15/23 : RUN if [ "$python_version" = "2" ]; then apk add --no-cache python; elif [ "$python_version" = "3" ]; then apk add --no-cache python3 && ln -s /usr/bin/python3 /usr/bin/python; fi
---> Using cache
---> 7e6dca36dad4
Step 16/23 : ADD $flink_dist $hadoop_jar $FLINK_INSTALL_PATH/
---> 5afb7a8e5414
Step 17/23 : ADD $job_artifacts/* $FLINK_JOB_ARTIFACTS_DIR/
---> c2789d3d80b3
Step 18/23 : RUN set -x && ln -s $FLINK_INSTALL_PATH/flink-[0-9]* $FLINK_HOME && ln -s $FLINK_JOB_ARTIFACTS_DIR $FLINK_USR_LIB_DIR && if [ -n "$python_version" ]; then ln -s $FLINK_OPT_DIR/flink-python*.jar $FLINK_LIB_DIR; fi && if [ -f ${FLINK_INSTALL_PATH}/flink-shaded-hadoop* ]; then ln -s ${FLINK_INSTALL_PATH}/flink-shaded-hadoop* $FLINK_LIB_DIR; fi && addgroup -S flink && adduser -D -S -H -G flink -h $FLINK_HOME flink && chown -R flink:flink ${FLINK_INSTALL_PATH}/flink-* && chown -R flink:flink ${FLINK_JOB_ARTIFACTS_DIR}/ && chown -h flink:flink $FLINK_HOME
---> Running in c4cb70216f08
+ ln -s /opt/flink-1.4.0 /opt/flink-1.4.0-bin-hadoop24-scala_2.11.tgz /opt/flink
+ ln -s /opt/artifacts /opt/flink/usrlib
+ '[' -n ]
+ '[' -f /opt/flink-shaded-hadoop-2-uber-2.4.1-8.0.jar ]
+ ln -s /opt/flink-shaded-hadoop-2-uber-2.4.1-8.0.jar /opt/flink/lib
+ addgroup -S flink
+ adduser -D -S -H -G flink -h /opt/flink flink
+ chown -R flink:flink /opt/flink-1.4.0 /opt/flink-1.4.0-bin-hadoop24-scala_2.11.tgz /opt/flink-shaded-hadoop-2-uber-2.4.1-8.0.jar
+ chown -R flink:flink /opt/artifacts/
+ chown -h flink:flink /opt/flink
Removing intermediate container c4cb70216f08
---> 459b1156294b
Step 19/23 : COPY docker-entrypoint.sh /
---> d4ae4be34415
Step 20/23 : USER flink
---> Running in 95a2c9234cd5
Removing intermediate container 95a2c9234cd5
---> ebdc913c7dd9
Step 21/23 : EXPOSE 8081 6123
---> Running in f6fad553a1d7
Removing intermediate container f6fad553a1d7
---> 51e6c57d2bde
Step 22/23 : ENTRYPOINT ["/docker-entrypoint.sh"]
---> Running in 09e7c0759fb6
Removing intermediate container 09e7c0759fb6
---> 99cdeb095b8f
Step 23/23 : CMD ["--help"]
---> Running in f985bd546dcf
Removing intermediate container f985bd546dcf
---> 039086df61e6
Successfully built 039086df61e6
Successfully tagged contxeng-flink-poc:1.4.0
Seems like everything went well.
To see which containers are running:
docker ps
contxeng-flink-poc:1.4.0, should be in there.
If you actually want to interact with Flink you should expose some ports.
The Flink dashboard for example runs on port 8081 of your container.
You can also get an interactive bash shell into your container by running the following command (if your container has bash installed):
docker exec -it contxeng-flink-poc:1.4.0 bash
That's where you will find your Flink binaries.
If the container is not running, check if it was built:
docker images
If that's the case, run it:
docker run -d contxeng-flink-poc:1.4.0
while trying to use the 3.5.5 enterprise Dockerfile (https://github.com/neo4j/docker-neo4j-publish/blob/master/3.5.5/community/Dockerfile) and to add YourKit's Docker related commands (https://www.yourkit.com/docs/java/help/docker.jsp)
so first I tried to docker build the Dockerfile without the Yourkit changes but I get this error:
Sending build context to Docker daemon 3.072kB │·······················
Step 1/13 : FROM openjdk:8-jre-alpine │·······················
---> f7a292bbb70c │·······················
Step 2/13 : RUN addgroup -S neo4j && adduser -S -H -h /var/lib/neo4j -G neo4j neo4j │·······················
---> Using cache │·······················
---> e0b1355abc58 │·······················
Step 3/13 : ENV NEO4J_SHA256=0421bb95fd377a1a45cd0a22f3f4163d8b2b07d1f9d8979e42c7f1952961ab92 NEO4J_TARBALL=neo4j-enterprise-3.5.5-unix.tar.gz NEO4J_EDITION=enterprise │·······················
NEO4J_HOME="/var/lib/neo4j" │·······················
---> Running in f33c9400f05b │·······················
Removing intermediate container f33c9400f05b │·······················
---> b5db09236a0f │·······················
Step 4/13 : ARG NEO4J_URI=http://dist.neo4j.org/neo4j-enterprise-3.5.5-unix.tar.gz │·······················
---> Running in 722c0d5ef000 │·······················
Removing intermediate container 722c0d5ef000 │·······················
---> 05ff355a8396 │·······················
Step 5/13 : COPY ./local-package/* /tmp/ │·······················
COPY failed: no source files were specified```
(edited)
Once this works I will add the yourkit specific RUN commands.
One could simply do the following instead:
FROM neo4j:3.5.5
RUN wget https://www.yourkit.com/download/docker/YourKit-JavaProfiler-2019.1-docker.zip -P /tmp/ && \
unzip /tmp/YourKit-JavaProfiler-2019.1-docker.zip -d /usr/local && \
rm /tmp/YourKit-JavaProfiler-2019.1-docker.zip
RUN apk add --no-cache --quiet libc6-compat
ENV PATH "${NEO4J_HOME}"/bin:/lib64:$PATH
ENV LD_LIBRARY_PATH /lib64:$LD_LIBRARY_PATH
VOLUME /data /logs
EXPOSE 7474 7473 7687 10001
ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"]
CMD ["neo4j"]
Server Version: 18.03.1-ce ,RHEL 7.2 .Here is my dockerfile:
FROM openjdk:8-jdk-alpine
ENV http_proxy http://192.168.156.25:3128
ENV https_proxy http://192.168.156.25:3128
RUN apk update && apk upgrade && apk add netcat-openbsd
RUN mkdir -p /usr/local/licensingservice
ADD #project.build.finalName#.jar /usr/local/licensingservice/
ADD run.sh run.sh
RUN chmod +x run.sh
CMD ./run.sh
it build without error:
---> Using cache
---> 8fa60876c229
Step 5/9 : RUN mkdir -p /usr/local/licensingservice
---> Using cache
---> bca46b1256e1
Step 6/9 : ADD licensing-service-0.0.1-SNAPSHOT.jar /usr/local/licensingservice/
---> a66979ed3755
Step 7/9 : ADD run.sh ./run.sh
---> 95b492565374
Step 8/9 : RUN chmod +x run.sh
---> Running in eec3075c30f3
Removing intermediate container eec3075c30f3
---> 96a2d7b89b80
Step 9/9 : CMD ./run.sh
---> Running in c338e9d33371
Removing intermediate container c338e9d33371
---> 324d5a83cf84
ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}
Successfully built 324d5a83cf84
Successfully tagged johncarnell/tmx-licensing-service:chapter4
but docker run -it 324d5a83cf84:
/bin/sh: ./run.sh: not found
I debug using docker run --rm -it 324d5a83cf84 cat ./run.sh,it print the file well.
run.sh:
#!/bin/sh
echo "hello1"
I suspect you are working on Windows and you are using the default Windows newline: CR LF. Change to LF in your run.sh and it will work like a charm.
But how to do that you ask? Open run.sh in Notepad++ and look at the bottom right of the window. Click on Windows (CR LF) and select Unix (LF).
I have following Dockerfile
#Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by creating a sample domain.
#
# Util scripts are copied into the image enabling users to plug NodeManager
# automatically into the AdminServer running on another container.
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ sudo docker build -t 12213-domain
#
# Pull base image
# ---------------
FROM oracle/weblogic:12.2.1.3-developer
# Maintainer
# ----------
MAINTAINER Monica Riccelli <monica.riccelli#oracle.com>
ARG DOMAIN_NAME
ARG ADMIN_PORT
ARG ADMIN_NAME
ARG ADMIN_USERNAME
ARG ADMIN_PASSWORD
# WLS Configuration
# ---------------------------
ENV ADMIN_HOST="wlsadmin" \
NM_PORT="5556" \
MS_PORT="8001" \
DEBUG_PORT="8453" \
ORACLE_HOME=/u01/oracle \
SCRIPT_FILE=/u01/oracle/createAndStartWLSDomain.sh \
CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostnameVerification=true" \
PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/user_projects/domains/${DOMAIN_NAME:-base_domain}/bin:/u01/oracle
# Domain and Server environment variables
# ------------------------------------------------------------
ENV DOMAIN_NAME="${DOMAIN_NAME}" \
PRE_DOMAIN_HOME=/u01/oracle/user_projects \
ADMIN_PORT="${ADMIN_PORT}" \
ADMIN_USERNAME="${ADMIN_USERNAME}" \
ADMIN_NAME="${ADMIN_NAME}" \
MS_NAME="${MS_NAME:-""}" \
NM_NAME="${NM_NAME:-""}" \
ADMIN_PASSWORD="${ADMIN_PASSWORD}" \
CLUSTER_NAME="${CLUSTER_NAME:-DockerCluster}" \
DEBUG_FLAG=true \
PRODUCTION_MODE=dev
# Add files required to build this image
COPY container-scripts/* /u01/oracle/
#Create directory where domain will be written to
USER root
RUN chmod +xw /u01/oracle/*.sh && \
chmod +xw /u01/oracle/*.py && \
mkdir -p $PRE_DOMAIN_HOME && \
chmod a+xr $PRE_DOMAIN_HOME && \
chown -R oracle:oracle $PRE_DOMAIN_HOME
VOLUME $PRE_DOMAIN_HOME
# Expose Node Manager default port, and also default for admin and managed server
EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT $DEBUG_PORT
USER oracle
WORKDIR $ORACLE_HOME
# Define default command to start bash.
CMD ["/u01/oracle/createAndStartWLSDomain.sh"]
Which I build using command
#!/bin/sh
#
#Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
docker build -t 12213-domain \
--no-cache \
--build-arg DOMAIN_NAME=domain \
--build-arg ADMIN_PORT=7001 \
--build-arg ADMIN_NAME=admin \
--build-arg ADMIN_USERNAME=wlsuser \
--build-arg ADMIN_PASSWORD=wlsuser1 \
.
And get the following build log
$ ./build.sh
Sending build context to Docker daemon 51.71kB
Step 1/17 : FROM oracle/weblogic:12.2.1.3-developer
---> 15ba3f59a9f9
Step 2/17 : MAINTAINER Monica Riccelli <monica.riccelli#oracle.com>
---> Running in ac70adb36a4b
Removing intermediate container ac70adb36a4b
---> fe34e24ffce7
Step 3/17 : ARG DOMAIN_NAME
---> Running in 073a89d7613c
Removing intermediate container 073a89d7613c
---> de10930a27d6
Step 4/17 : ARG ADMIN_PORT
---> Running in d213833315c2
Removing intermediate container d213833315c2
---> 9af410c46028
Step 5/17 : ARG ADMIN_NAME
---> Running in 2baee277da54
Removing intermediate container 2baee277da54
---> a76f3f3d6642
Step 6/17 : ARG ADMIN_USERNNAME
---> Running in 9127852dae20
Removing intermediate container 9127852dae20
---> bb9af74b5804
Step 7/17 : ARG ADMIN_PASSWORD
---> Running in 4d0b1969605b
Removing intermediate container 4d0b1969605b
---> af18d5b6be2d
Step 8/17 : ENV ADMIN_HOST="wlsadmin" NM_PORT="5556" MS_PORT="8001"
DEBUG_PORT="8453" ORACLE_HOME=/u01/oracle SCRIPT_FILE=/u01/oracle/create
AndStartWLSDomain.sh CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostname
Verification=true" PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/ora
cle/wlserver/common/bin:/u01/oracle/user_projects/domains/${DOMAIN_NAME:-base_do
main}/bin:/u01/oracle
---> Running in 449a28590d90
Removing intermediate container 449a28590d90
---> 2a1ddd961d5c
Step 9/17 : ENV DOMAIN_NAME="${DOMAIN_NAME}" PRE_DOMAIN_HOME=/u01/oracle/use
r_projects ADMIN_PORT="${ADMIN_PORT}" ADMIN_USERNAME="${ADMIN_USERNAME}
" ADMIN_NAME="${ADMIN_NAME}" MS_NAME="${MS_NAME:-""}" NM_NAME="${NM_
NAME:-""}" ADMIN_PASSWORD="${ADMIN_PASSWORD}" CLUSTER_NAME="${CLUSTER_NA
ME:-DockerCluster}" DEBUG_FLAG=true PRODUCTION_MODE=dev
---> Running in 0b01881a1ca4
Removing intermediate container 0b01881a1ca4
---> 7a3cd53ea5a3
Step 10/17 : COPY container-scripts/* /u01/oracle/
---> ce67247c3f7e
Step 11/17 : USER root
---> Running in 61adcafc1226
Removing intermediate container 61adcafc1226
---> f9a781fda963
Step 12/17 : RUN chmod +xw /u01/oracle/*.sh && chmod +xw /u01/oracle/*.py &&
mkdir -p $PRE_DOMAIN_HOME && chmod a+xr $PRE_DOMAIN_HOME && chown -
R oracle:oracle $PRE_DOMAIN_HOME
---> Running in 82b7b258d6f1
Removing intermediate container 82b7b258d6f1
---> 0cda254bc640
Step 13/17 : VOLUME $PRE_DOMAIN_HOME
---> Running in 6650ff8092d3
Removing intermediate container 6650ff8092d3
---> c469ff0ac9a2
Step 14/17 : EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT $DEBUG_PORT
---> Running in a551b6bd5363
Removing intermediate container a551b6bd5363
---> 08253c4d94bd
Step 15/17 : USER oracle
---> Running in f1e6b4e482e9
Removing intermediate container f1e6b4e482e9
---> 85a75641e866
Step 16/17 : WORKDIR $ORACLE_HOME
Removing intermediate container a2b75ecbb0b6
---> 0124a8251ce3
Step 17/17 : CMD ["/u01/oracle/createAndStartWLSDomain.sh"]
---> Running in 1455fdc0d39d
Removing intermediate container 1455fdc0d39d
---> c1c947c2816c
[Warning] One or more build-args [ADMIN_USERNAME] were not consumed
Successfully built c1c947c2816c
Successfully tagged 12213-domain:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Win
dows Docker host. All files and directories added to build context will have '-r
wxr-xr-x' permissions. It is recommended to double check and reset permissions f
or sensitive files and directories.
Note the message
[Warning] One or more build-args [ADMIN_USERNAME] were not consumed
When I start the container and print the environment
FMW_PKG=fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip
CONFIG_JVM_ARGS=-Dweblogic.security.SSL.ignoreHostnameVerification=true
HOSTNAME=74adf82e8092
PRODUCTION_MODE=dev
TERM=xterm
ADMIN_NAME=AdminServer
CLUSTER_NAME=DockerCluster
FMW_JAR=fmw_12.2.1.3.0_wls_quick.jar
USER_MEM_ARGS=-Djava.security.egd=file:/dev/./urandom
DEBUG_FLAG=true
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd
=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;4
2:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:
*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=0
1;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;
31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=0
1;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sa
r=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:
*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01
;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.ti
ff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;3
5:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp
4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:
*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01
;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=
01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.f
lac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;
36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
MS_NAME=
DOMAIN_NAME=base_domain
SCRIPT_FILE=/u01/oracle/createAndStartWLSDomain.sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/java/defa
ult/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u0
1/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/us
er_projects/domains/base_domain/bin:/u01/oracle
ADMIN_HOST=wlsadmin
DOMAIN_HOME=/u01/oracle/user_projects/domains/base_domain
NM_NAME=
PWD=/u01/oracle
DEBUG_PORT=8453
ADMIN_PORT=7001
JAVA_HOME=/usr/java/default
JAVA_PKG=server-jre-8u*-linux-x64.tar.gz
SHLVL=1
HOME=/u01/oracle
ADMIN_USERNAME=weblogic
NM_PORT=5556
PRE_DOMAIN_HOME=/u01/oracle/user_projects
ADMIN_PASSWORD=
ORACLE_HOME=/u01/oracle
MS_PORT=8001
_=/usr/bin/env
The environment variables are not set correctly, but uses the environment variables from the base image. I want to override those variables.
EDIT:
The problem is either --build-arg not passing the parameters to ARG, or ARG not correctly binding to ENV. Environment is overridden correctly, if I use constant string in the ENV. Even more interestingly, if I don't pass --build-arg to those ARG variables, I don't get any warning or error and still get the exactly same build log. AFAIK, unbound ARG without default value should raise an error.
Is this a bug? I'm using docker-toolbox on windows, and here is the docker version
docker-machine.exe version 0.14.0, build 89b8332
Docker version 18.03.0-ce, build 0520e24302
From docs.docker.com:
Environment variables defined using the ENV instruction always
override an ARG instruction of the same name
So the only way to resolve this is to use different name for ARG variables.
There is a typo in your ARG declaration.
I think change that to ADMIN_USERNAME will fix your problem.