I made a docker-composer.yml because it's cleaner.
From these commands below:
docker run -d -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -e POSTGRES_USER=rundeck -e POSTGRES_PASSWORD=rundeck --name rundeck_db postgres:9.4.5
docker run --rm -ti -p 192.168.59.103:4440:4440 --link rundeck_db:db --name rundeck 3a34fdafc98a
To:
rundeck_db:
image: postgres:9.4.5
environment:
POSTGRES_USER: rundeck
POSTGRES_PASSWORD: rundeck
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
ports:
- "5432:5432"
rundeck:
build: .
ports:
- "192.168.59.103:4440:4440"
links:
- rundeck_db:db
And Dockerfile is
FROM mbopm/ubuntu-oracle-java:2.0
# install rundeck
RUN wget -O /opt/rundeck.deb http://dl.bintray.com/rundeck/rundeck-deb/rundeck-2.6.1-1-GA.deb && \
dpkg -i /opt/rundeck.deb && \
rm -rf /opt/rundeck.deb /var/lib/apt/lists/* /tmp/* /var/tmp/*
# change base configuration
RUN mkdir /etc/service/rundeck && \
mkdir /var/lib/rundeck/.ssh && \
chown -R rundeck:rundeck /var/lib/rundeck
# add init and startup scripts
ADD assets/run/rundeck.sh /etc/service/rundeck/run
ADD assets/startup/* /etc/my_init.d/
# http, https
EXPOSE 4440
# project files
# configs
# ssh-keys
# logs
VOLUME [ "/var/rundeck", "/etc/rundeck", "/var/lib/rundeck/.ssh", "/var/log/rundeck" ]
Suddenly it doesn't function. (Postgres works, but Rundeck doesn't.)
Also docker ps says
COMMAND part should be /sbin/my_init instead of /bin/sh -c ./run.sh
Any ideas?
Add
CMD [ "/sbin/my_init" ]
at the end of your dockerfile in order to change the COMMAND part
you can also add command to you docker-compose.yml file
rundeck:
build: .
command: /sbin/my_init
ports:
- "192.168.59.103:4440:4440"
links:
- rundeck_db:db
Related
I am deploying on AWS clamav
whos Dockerfile is :
FROM alpine:3.14
LABEL maintainer="Markus Kosmal <code#m-ko.de>"
RUN apk add --no-cache bash clamav clamav-daemon clamav-libunrar
COPY conf /etc/clamav
COPY bootstrap.sh /
COPY envconfig.sh /
COPY check.sh /
RUN mkdir /var/run/clamav && \
chown clamav:clamav /var/run/clamav && \
chmod 750 /var/run/clamav && \
chown -R clamav:clamav bootstrap.sh check.sh /etc/clamav && \
chmod u+x bootstrap.sh check.sh
EXPOSE 3310/tcp
USER clamav
CMD ["/bootstrap.sh"]
and since I am using a mirror I am testing locally using a docker-compose file
version: "3.7"
services:
mirror:
build:
context: .
dockerfile: mirror/Dockerfile
ports:
- "8080:8080"
clamav:
build:
context: ../clamav
environment:
CLAMAVDATABASEMIRROR: "http://0.0.0.0:8080"
depends_on:
- mirror
ports:
- "3310:3310"
services work fine and when I run docker-compose up --build I can see from the logs that the services is pulling the daily update and stuff.
if I run docker container ls
I get that clamav has ports: 3310/tcp wheras the mirror has a mapped port on my local host
0.0.0.0:8080->8080/tcp
and I can run curl localhost:8080
But If I try and curl localhost on 3310 I get
curl: (52) Empty reply from server
now: how do I perform a healthcheck on the clamav service?
I have a web server program which requires pdf files from owncloud server. I'm making installation code via docker-compose & docker hub.
I use Ubuntu 20.04LTS and Docker Compose v2.1.0.
Here is the process
store pdf files and create public links in owncloud docker container(under /var/www/owncloud/data)
create new images(both owncloud, mariadb) and tags from container by code below
docker commit 5cba8bf76904
docker tag 9315184e23f5 DOCKERID/docker-mariadb
docker push DOCKERID/docker-mariadb
pull those images in another new fresh Ubuntu server, using docker-compose up
After this process, when I connect to owncloud, running on a new fresh ubuntu server, there are no pdf files and all those configs are intialized (owncloud account, mariadb database configs)
and the owncloud start-up page(config admin account and database page) is opened.
My docker-compose, Dockerfiles are below(related parts only)
docker-compose.yml
owncloud:
#build: ./dockerfiles/owncloud/
image: "dockerhubid/docker-owncloud"
container_name: chatbot_owncloud
restart: always
networks:
- chatbot_network
depends_on:
- mariadb
volumes:
- 'owncloud_php:/var/www/owncloud'
command: php-fpm7.4 -F -R
mariadb:
# build: ./dockerfiles/mariadb/
image: dockerhubid/docker-mariadb
container_name: mariadb
restart: always
expose:
- '3306'
networks:
- chatbot_network
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=owncloud
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=owncloud
command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
nginx:
#build: ./dockerfiles/nginx/
image: "dockerhubid/docker-nginx"
container_name: chatbot_nginx
restart: always
depends_on:
- owncloud
volumes:
- ./dockerfiles/certbot/conf:/etc/letsencrypt
- ./dockerfiles/certbot/www:/var/www/certbot
volumes_from:
- 'owncloud:ro'
networks:
- chatbot_network
ports:
- '80:80'
- '3000:3000'
- '8883:8883'
- '8884:8884'
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
container_name: chatbot_certbot
networks:
- chatbot_network
volumes:
- ./dockerfiles/certbot/conf:/etc/letsencrypt
- ./dockerfiles/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
owncloud Dockerfile
FROM ubuntu:20.04
EXPOSE 9000
ARG DEBIAN_FRONTEND=noninteractive
# dependencies
RUN apt update && apt upgrade -y
RUN apt install -y php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip php-mysql php-fpm wget zip vim
# owncloud
RUN wget https://download.owncloud.org/community/owncloud-10.5.0.zip
RUN unzip owncloud-10.5.0.zip -d /var/www/
RUN rm /owncloud-10.5.0.zip
WORKDIR /var/www/owncloud
RUN chown www-data:www-data -R /usr/bin/php /var/www/owncloud/
RUN chmod -R 755 /var/www/owncloud/
# php-fpm setup
RUN sed -i 's+/run/php/php7.4-fpm.sock+9000+g' /etc/php/7.4/fpm/pool.d/www.conf
ADD init.sh /docker-entrypoint-initdb.d/
RUN chmod 755 /docker-entrypoint-initdb.d/init.sh
mariadb Dockerfile
from mariadb:10.5
EXPOSE 3306
ARG DEBIAN_FRONTEND=noninteractive
USER root
ADD init.sql /docker-entrypoint-initdb.d/
RUN chmod 755 /docker-entrypoint-initdb.d/init.sql
How can I maintain those files and public links?
Why are those things removed after docker hub push&pull?
I tried it with the owncloud official image first, but by my investigation official image stores data in external docker volume.
I thought that's why my data is gone after docker push&pull.
so I'm trying it by manual installation.
I'm attempting to SSHFS from the container to a remote server, with the mount created during the Dockerfile build.
The mount command works if executed in the already running container, and will work if I make the command the entrypoint (but then I have to string on the real entrypoint script on the end with a ; which feels too klugy.)
If I put the command in the Dockerfile with a RUN, it fails with a fuse: device not found, try 'modprobe fuse' first error.
Here's the files...
install.sh
#!/bin/bash
USAGE="install.sh <dir_to_parse> <filetype_to_parse>"
if [ $# -lt 2 ]
then
echo "$USAGE"
exit 1
fi
REMOTE_DIR=$1 FILE_EXTENSION=$2 docker-compose -p '' -f docker-compose.yml up -d --build
docker-compose.yml
version: "3"
services:
source.test:
build:
context: .
dockerfile: ./Dockerfile
image: test.source
container_name: test.source
environment:
ELASTIC_HOST: “http://<redacted>:<redacted>”
REMOTE_SERVER: <redacted>
REMOTE_USER: <redacted>
REMOTE_KEY: /etc/ssl/certs/<redacted>
FEEDER_URL: http://<redacted>/api
MONGOHOST: mongo
WALKDIRS: <redacted>
REMOTE_DIR: ${REMOTE_DIR}
FILE_EXTENSION: ${FILE_EXTENSION}
volumes:
- /etc/ssl/certs/:/etc/ssl/certs/
ports:
- 127.0.0.1:6000:80
cap_add:
- SYS_ADMIN
devices:
- "/dev/fuse:/dev/fuse"
security_opt:
- "apparmor:unconfined"
networks:
default:
external:
name: test
Dockerfile
FROM ubuntu:18.04
RUN apt-get update && apt-get -y install \
fuse \
sshfs
COPY <redacted> /etc/ssl/certs/<redacted>
COPY fuse.conf /etc/fuse.conf
RUN chown root:root /etc/fuse.conf
RUN chmod 644 /etc/fuse.conf
RUN mkdir /mnt/filestobeparsed
# Fails with fuse: device not found
RUN sshfs username#<xxx.xxx.xxx.xxx>:/remote/path /mnt/filestobeparsed -o StrictHostKeyChecking=no,IdentityFile=/etc/ssl/certs/<redacted>,auto_cache,reconnect,transform_symlinks,follow_symlinks,allow_other
ENTRYPOINT tail -f /dev/null
# Works but is klugy
#ENTRYPOINT sshfs username#<xxx.xxx.xxx.xxx>:/remote/path /mnt/filestobeparsed -o StrictHostKeyChecking=no,IdentityFile=/etc/ssl/certs/<redacted>,auto_cache,reconnect,transform_symlinks,follow_symlinks,allow_other; tail -f /dev/null
I have several files in a directory on the host machine which I am trying to copy to the Docker container.
The problem is that the files do get copied to the destination but all the existing files inside the destination directory get removed.
Before adding these new ADD lines to my Dockerfile, I had like 20 jar files in the lib directory, by adding these ADD lines the two crowd files below, all 20 existing jar files get deleted and the directory will now contains only two crowd files which were just copied from the host into the container!
I tried without the user ROOT but it would not copy the server.xml and tomcat.keystore
FROM guacamole/guacamole
RUN sed -i 's/redirectPort="8443"/redirectPort="8443" server="" secure="true"/g' /usr/local/tomcat/conf/server.xml \
&& sed -i 's/<Server port="8005" shutdown="SHUTDOWN">/<Server port="-1" shutdown="SHUTDOWN">/g' /usr/local/tomcat/conf/server.xml \
&& rm -rf /usr/local/tomcat/webapps/docs/* \
&& rm -rf /usr/local/tomcat/webapps/examples/* \
&& rm -rf /usr/local/tomcat/webapps/manager/* \
&& rm -rf /usr/local/tomcat/webapps/host-manager/*
WORKDIR /usr/local/tomcat
USER root
COPY server.xml conf/server.xml
RUN chmod 660 conf/server.xml
USER root
ADD tomcat.keystore /usr/local/tomcat/
RUN chmod 644 tomcat.keystore
RUN chown root:staff /usr/local/tomcat/tomcat.keystore
ADD ./lib/crowd-auth-filter-1.0.0.jar /usr/local/tomcat/webapps/guacamole/WEB-INF/lib/crowd-auth-filter-1.0.0.jar
ADD ./lib/crowd-filter.properties /usr/local/tomcat/webapps/guacamole/WEB-INF/lib/crowd-filter.properties
RUN chmod 644 /usr/local/tomcat/webapps/guacamole/WEB-INF/lib/crowd-filter.properties
ADD web.xml /usr/local/tomcat/webapps/guacamole/WEB-INF/web.xml
CMD /usr/local/tomcat/bin/shutdown.sh && /usr/local/tomcat/bin/startup.sh
docker-compose.yml:
version: '2'
services:
guacd:
hostname: guacd
image: guacamole/guacd
restart: always
container_name: guacd
mysql:
hostname: mysql
image: mysql:5.7
volumes:
- ./tmp/scripts:/docker-entrypoint-initdb.d
restart: always
container_name: mysql
ports:
- "3306:3306"
environment:
- MYSQL_DATABASE="guacamole"
- MYSQL_USER="guacamole"
- MYSQL_PASSWORD="password"
- MYSQL_ROOT_PASSWORD="password"
guacamole:
build: .
image: mine/guacamole
restart: always
ports:
- "8443:8443"
links:
- guacd
- mysql
container_name: guacamole
environment:
- GUACD_HOSTNAME=guacd
- GUACAMOLE_HOME=/opt/guacamole-home
volumes:
tmp-scripts:
To get things started:
1) I build the guacamole image with docker build . --no-cache -t mine/guacamole
2) Start the containers and create the services by running: docker-compose up --force-recreate -d
Can someone please help?
Thanks
I'm using Docker to host a Jena/Fuseki container. I have a very outdated Fuseki instance on another server that I would like to migrate the data from. I've backed up the old server into a .nq file, but I can't create a new datastore with this file.
Dockerfile:
FROM openjdk:10
ENV JENAVERSION=3.7.0
ENV FUSEKI_HOME=/fuseki
RUN mkdir /fuseki
RUN mkdir /jena
RUN wget http://apache.claz.org/jena/binaries/apache-jena-fuseki-$JENAVERSION.tar.gz -P /tmp \
&& tar -zxvf /tmp/apache-jena-fuseki-$JENAVERSION.tar.gz -C /tmp \
&& mv -v /tmp/apache-jena-fuseki-$JENAVERSION/* /fuseki
RUN wget http://apache.claz.org/jena/binaries/apache-jena-$JENAVERSION.tar.gz -P /tmp \
&& tar -zxvf /tmp/apache-jena-$JENAVERSION.tar.gz -C /tmp \
&& mv -v /tmp/apache-jena-$JENAVERSION/* /jena
EXPOSE 3030
ENTRYPOINT ["/bin/bash", "/fuseki/fuseki-server"]
Docker-Compose file:
version: '2'
services:
fuseki_test:
build:
context: /docker/buildfiles/
dockerfile: /docker/buildfiles/fuseki
restart: unless-stopped
ports:
- "19095:3030"
volumes:
- "/docker/jena2/databases/data:/run/databases/PDE_PROD"
- "/docker/jena2/backups:/run/backups"
- "/docker/jena2/shiro.ini:/run/shiro.ini:ro"
- "/docker/jena2/fuseki-tdb2.ttl:/run/config.ttl:ro"
- "/docker/data:/staging"
environment:
- ADMIN_PASSWORD=password
- JVM_ARGS=-Xmx16g
Here's the command I used to try to load the data:
/bin/bash /jena/bin/tdb2.tdbloader --loc=/run/databases/PDE_PROD /staging/PDE_DEV_2_2018-02-15_12-51-30.nq
Everything loads without errors, the data shows up in the folder I would expect, no errors starting Fuseki, but no triples show up.