Today I decided to create my first docker container. I read some guides and started working on a Dockerfile that will install a Rundeck container.
FROM ubuntu:18.04
MAINTAINER namehere <email@here.net>
RUN apt-get update && apt-get install -y wget openjdk-11-jdk uuid-runtime openssh-client apt-utils && apt-get clean
RUN wget https://dl.bintray.com/rundeck/rundeck-deb/rundeck_3.2.5.20200403-1_all.deb
RUN dpkg -i rundeck_3.2.5.20200403-1_all.deb
RUN sed -i -e 's/localhost/$SERVER_IP/g' /etc/rundeck/rundeck-config.properties /etc/rundeck/framework.properties
VOLUME ["/etc/rundeck"]
VOLUME ["/var/lib/rundeck"]
VOLUME ["/var/log/rundeck"]
EXPOSE 4440
CMD service rundeckd start && tail -F /var/log/rundeck/service.log
My issue here is that when a user installs the container, they need to define an option that will in turn define the $SERVER_IP variable, which need to be modified in 2 files, as shown above.
Ideally the container would be installed using a command like this.
docker run -d \
--restart=always \
--name rundeck \
-h rundeck \
-e PUID=1001 \
-e PGID=1001 \
-e TZ=Europe/Nicosia \
--net=network \
-p 4440:4440 \
-e SERVER_IP=192.168.1.25 \
rundeck
How can I achieve this?
Thanks