configuring tomcat inside makuk66/docker-solr image
Closed this issue · 1 comments
Hi,
I am totally new in docker and using your image as a base to configure tomcat in it but I am getting following error
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Here is my docker file
FROM makuk66/docker-solr
MAINTAINER omi "omit@thedigitalgroup.in"
RUN apt-get update
RUN apt-get -y install tomcat8
RUN echo "JAVA_HOME=/usr/lib/jvm/java-7-oracle" >> /etc/default/tomcat8
EXPOSE 8080
CMD service tomcat8 start && tail -f /var/lib/tomcat8/logs/catalina.out
Please suggest me the correct way if I am making any mistake.
Thanks
The error messages indicate that your apt-get
is not running as root; because the makuk66/docker-solr
Dockerfile has a USER
instruction that make things run as user solr
. You can explicitly change it back to root. For example:
FROM makuk66/docker-solr
MAINTAINER Martijn Koster "mak-docker@greenhills.co.uk"
RUN id
user root
RUN id
user solr
RUN id
gives:
$ docker build -t makuk66/idtest .
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM makuk66/docker-solr
---> 554f3177519d
Step 1 : MAINTAINER Martijn Koster "mak-docker@greenhills.co.uk"
---> Running in 7507098e5162
---> e52884235fec
Removing intermediate container 7507098e5162
Step 2 : RUN id
---> Running in 7e0564e665ae
uid=999(solr) gid=999(solr) groups=999(solr)
---> ef23aa8306a4
Removing intermediate container 7e0564e665ae
Step 3 : USER root
---> Running in 9a30d287b46d
---> 329e84ec2335
Removing intermediate container 9a30d287b46d
Step 4 : RUN id
---> Running in 4a4e4f414e70
uid=0(root) gid=0(root) groups=0(root)
---> 1a98c2021cf2
Removing intermediate container 4a4e4f414e70
Step 5 : USER solr
---> Running in e365f08bae02
---> e61c2aae1217
Removing intermediate container e365f08bae02
Step 6 : RUN id
---> Running in 5c61a2298feb
uid=999(solr) gid=999(solr) groups=999(solr)
---> 5170ec5b744a
Removing intermediate container 5c61a2298feb
Successfully built 5170ec5b744a
By the way, I don't see why you'd want to run tomcat in the same container as solr: you don't need it for solr, and if you want it for another purpose then it may be better running in its own container.