Answer the question
In order to leave comments, you need to log in
Are there examples of dockerfile somewhere, for connecting in docker-compose with the database?
There is a documize service, it consists of one binary. He needs a database to work.
I tried wrapping the service in a container:
FROM ubuntu:latest
ENV DB_USER=""
ENV DB_PASS=""
ENV DB_NAME=""
WORKDIR /documize
ADD . /documize
RUN chmod 700 ./documize-enterprise-linux-amd64
EXPOSE 5001
CMD ["sh","-c","./documize-enterprise-linux-amd64 -port=5001 -db='${DB_USER}:${DB_PASS}@tcp(localhost:3306)/${DB_NAME}' -dbtype=mysql -salt=salt"]
version: '2'
networks:
bridge:
driver: bridge
services:
web:
image: "documize:latest"
container_name: documize
depends_on:
- db
ports:
- "5001:5001"
environment:
- DB_USER=MYSQL_USER
- DB_PASS=MYSQL_PASSWORD
- DB_NAME=MYSQL_DATABASE
links:
- db
networks:
- bridge
db:
image: "mysql:5.7"
container_name: documize_db
volumes:
- mysql-data:/var/lib/mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=MYSQL_ROOT_PASSWORD
- MYSQL_USER=MYSQL_USER
- MYSQL_PASSWORD=MYSQL_PASSWORD
- MYSQL_DATABASE=MYSQL_DATABASE
networks:
- bridge
volumes:
mysql-data: {}
Answer the question
In order to leave comments, you need to log in
Hi you need to pass
CMD ["sh","-c","./documize-enterprise-linux-amd64 -port=5001 -db='${DB_USER}:${DB_PASS}@tcp(localhost:3306) /${DB_NAME}' -dbtype=mysql -salt=salt"]
on
CMD ["sh","-c","./documize-enterprise-linux-amd64 -port=5001 -db='${DB_USER} :${DB_PASS}@${DB_HOST}:3306 /${DB_NAME}' -dbtype=mysql -salt=salt"]
and pass host by container name (db example), Alya DB_USER=db
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question