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"]
Related
My Dockerfile
FROM alpine:latest
WORKDIR /usr/src/app
COPY ./init.sh /usr/src/app
RUN chmod +x init.sh
CMD ["sh","-c","init.sh"]
Build goes OK
docker build . -t test
Sending build context to Docker daemon 3.072kB
Step 1/5 : FROM alpine:latest
---> e66264b98777
Step 2/5 : WORKDIR /usr/src/app
---> Running in 1ff4467854af
Removing intermediate container 1ff4467854af
---> 6b4f1fa4ca1c
Step 3/5 : COPY ./init.sh /usr/src/app
---> e61e55063baa
Step 4/5 : RUN chmod +x init.sh
---> Running in ae3724c0f595
Removing intermediate container ae3724c0f595
---> 3c2cd99a30b9
Step 5/5 : CMD ["sh","-c","init.sh"]
---> Running in 9df8c7d70e38
Removing intermediate container 9df8c7d70e38
---> bd9c9af6380d
Successfully built bd9c9af6380d
Successfully tagged test:latest
I got this
docker run -it test
sh: init.sh: not found
Why?
Use ./init.sh to execute the script, provided that the shell script has a proper shebang like #!/bin/sh on the top:
FROM alpine:latest
WORKDIR /usr/src/app
COPY ./init.sh /usr/src/app
RUN chmod +x init.sh
CMD ["sh", "-c", "./init.sh"]
Note that it's actually not necessary, and can be shortened as CMD ./init.sh.
I have been given a project that is in a Docker container. I have managed to build the Docker container image and tag it, but when I run it I have problems.
bash-5.1$ docker build -t game:0.0.1 -t game:latest .
Sending build context to Docker daemon 2.584MB
Step 1/12 : FROM nvidia/cuda:10.2-base-ubuntu18.04
---> 84b82c2f5736
Step 2/12 : MAINTAINER me
---> Using cache
---> b8a86a8860d5
Step 3/12 : EXPOSE 5006
---> Using cache
---> fabdfc06768c
Step 4/12 : EXPOSE 8888
---> Using cache
---> a6f8585ce52d
Step 5/12 : ENV DEBIAN_FRONTEND noninteractive
---> Using cache
---> c4dd4de87fdc
Step 6/12 : ENV WD=/home/game/
---> Using cache
---> 871163f5db29
Step 7/12 : WORKDIR ${WD}
---> Using cache
---> 36678a12e551
Step 8/12 : RUN apt-get -y update && apt-get -y upgrade && apt-get -y install git ssh pkg-config python3-pip python3-opencv
---> Using cache
---> 4b83b4944484
Step 9/12 : COPY requirements.txt /requirements.txt
---> Using cache
---> 8e1db9206e80
Step 10/12 : RUN cd / && python3 -m pip install --upgrade pip && pip3 install -r requirements.txt
---> Using cache
---> e096029d458a
Step 11/12 : CMD ["start.py"]
---> Using cache
---> 795bb5a65bc8
Step 12/12 : ENTRYPOINT ["python3"]
---> Using cache
---> 59b472b693f2
Successfully built 59b472b693f2
Successfully tagged game:0.0.1
Successfully tagged game:latest
bash-5.1$ docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix game:latest
Unable to find image 'game:latest' locally
docker: Error response from daemon: pull access denied for game, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
bash-5.1$ sudo docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix game:latest
It doesn't seem to find the game:latest image even though the output of the above command says it just created it.
I also try to do this after logging into my session.
I tried to run 59b472b693f2 (what is it, is it a container hash code?):
bash-5.1$ docker run 59b472b693f2
python3: can't open file 'start.py': [Errno 2] No such file or directory
bash-5.1$ ls
data_collection demonstrateur.ipynb demo.py Dockerfile examples README.md requirements.txt serious_game start.py test
bash-5.1$
Here is the list of available images:
bash-5.1$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
game 0.0.1 7e7ad7272cf0 15 minutes ago 1.77GB
game latest 7e7ad7272cf0 15 minutes ago 1.77GB
ubuntu latest ba6acccedd29 7 weeks ago 72.8MB
hello-world latest feb5d9fea6a5 2 months ago 13.3kB
nvidia/cuda 10.2-base-ubuntu18.04 84b82c2f5736 2 months ago 107MB
bash-5.1$ docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix game:latest
python3: can't open file 'start.py': [Errno 2] No such file or directory
bash-5.1$
I tried to add it in the Dockerfile but still got the same error:
Removing intermediate container 10f2d7506d17
---> 1b776923e5a9
Step 11/13 : COPY start.py /start.py
---> 172c81ff16e9
Step 12/13 : CMD ["start.py"]
---> Running in c7217e2e0f21
Removing intermediate container c7217e2e0f21
---> eaf947ffa0b1
Step 13/13 : ENTRYPOINT ["python3"]
---> Running in 77e2e7b90658
Removing intermediate container 77e2e7b90658
---> 924d8c473e36
Successfully built 924d8c473e36
Successfully tagged seriousgame:0.0.1
Successfully tagged seriousgame:latest
bash-5.1$ docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix seriousgame:latest
python3: can't open file 'start.py': [Errno 2] No such file or directory
Here is my Dockerfile:
#############################################################################################################
#
# Creation du container
#
##############################################################################################################
FROM nvidia/cuda:10.2-base-ubuntu18.04
MAINTAINER me
EXPOSE 5006
EXPOSE 8888
ENV DEBIAN_FRONTEND noninteractive
ENV WD=/home/game/
WORKDIR ${WD}
# Add git and ssh
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get -y install git ssh pkg-config python3-pip python3-opencv
# Dépendances python
COPY requirements.txt /requirements.txt
RUN cd / && \
python3 -m pip install --upgrade pip && \
pip3 install -r requirements.txt
COPY start.py /start.py
CMD ["start.py"]
ENTRYPOINT ["python3"]
Here are all the files within my project:
bash-5.1$ ls
data_collection demonstrateur.ipynb demo.py Dockerfile examples README.md requirements.txt serious_game start.py test
In the first block of code you posted it says Successfully tagged game:latest and Successfully tagged game:0.0.1, but in your docker images output you don't see those images. Looking at the output of your docker images I see that the last time you built the image named serious-game was 1 hour ago. I'm guessing so that you tried to rename the image, but the image ID didn't change.
You can try to remove the old image with docker image rm command (docs), and then try to build it again. The commands sequence to execute is the code block below. Data should be safe becouse I see that you're using volumes (I assume that you know what you're doing).
docker image rm 59b472b693f2
docker build -t game:0.0.1 -t game:latest .
The sequence 59b472b693f2 is the unique ID of the image in your Docker local environment (you can assume that it's an ID like the ones used in databases for indexing).
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
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
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).