-
Notifications
You must be signed in to change notification settings - Fork 848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker compose #91
Comments
Hello, In order to fix that, I created another container, expecially for the init of the db, it looks like this : FROM debian:jessie
RUN apt-get update && apt-get install -y netcat
# in order to have psql
RUN apt-get install -y postgresql-client
ADD ./init_schema.sql /
ADD ./start.sh /start.sh
CMD ["/start.sh"] and the start.sh looks like this : #!/bin/sh
while ! nc -z postgres 5432;do sleep 3;done
# now that the database is up, we can log into it and launch the init
PGPASSWORD=my password psql -h name_in_docker_compose -U user database< init_schema.sql
echo 'init done'
The part with the while is here to be sure the database is up before filling it with data. version: '3'
services:
postgres:
build:
context: ./postgres
container_name: postgres
postgres_init:
build:
context: ./postgres/postgres_init
container_name: postgres_init
depends_on:
- postgres I also put the command "postgres -c shared_preload_libraries=timescaledb" in the dockerfile as CMD [...] instead of the docker-compose. This workaround works but it is not really clean, I admit, but it works until we find something better. |
Hi, we just released a new version (0.0.12-beta) that also included a new build process for Docker images (using the timescale/timescaledb-docker repo). This should have streamlined the build image, so maybe give it a try and see if it works better with Docker Compose? If not we can do some more investigating. |
I tested it today, it works perfectly, good job. Now you can add you init scripts to /docker-entrypoint-initdb.d in the timescaledb docker, postgres will use it correctly (without saying that it can't use plugin timescaledb or whatever) |
Hey guys,
I am trying to bring up TimescaleDB via Docker Compose (as opposed to Docker run) and it seems to me that the extension is not being loaded.
Dockerfile
initialize.sh
Compose.yml
As you can see I am trying to load timescaledb extension via
command: postgres -c shared_preload_libraries=timescaledb
but it looks like nothing is happening. This is what I get as an output:And consequently that's why create_hypertable fails.
Starting TimescaleDB via Docker run works for me without any issues. I also tried to put aftermentioned
postgres -c shared_preload_libraries=timescaledb
command to Dockerfile, but it did not help.Am I missing something? How are you doing your Docker compose?
Thanks in advance.
Best wishes,
Martin
The text was updated successfully, but these errors were encountered: