I need to build docker image with postgres with data included [closed]
up vote
1
down vote
favorite
So, I need docker image with: my program that use postgresql, postgresql and some data in it
I use this article: https://medium.com/@sharmaNK/build-postgres-docker-image-with-data-included-489bd58a1f9e
My steps:
docker-compose build
//Creates ps_image_with_datadocker run --name ps-export -p 5432:5432 -i postgres
- Connect to 5432 db, using dbeaver; create table; put some rows in the table
docker exec -it my_container_with_data_id bash
mkdir /postgres
cp -r /var/lib/postgresql/data/* /postgres
docker commit ps-export ps_image_with_data
docker run --env PGDATA=postgres -p 5432:5432 -i ps_image_with_data
// here I've tried both ps_image_with_data and new image that was created on step 7
And after 8 step I got this:
2018-11-08 12:44:52.549 UTC [1] LOG: listening on IPv4 address
"0.0.0.0", port 5432 2018-11-08 12:44:52.549 UTC [1] LOG: listening
on IPv6 address "::", port 5432 2018-11-08 12:44:52.615 UTC [1] LOG:
listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2018-11-08 12:44:52.750 UTC [22] LOG: database system was
interrupted; last known up at 2018-11-08 11:56:27 UTC 2018-11-08
12:45:25.042 UTC [22] LOG: could not remove cache file
"global/pg_internal.init": Permission denied 2018-11-08 12:45:25.042
UTC [22] LOG: could not remove cache file
"base/13067/pg_internal.init": Permission denied 2018-11-08
12:45:25.042 UTC [22] LOG: database system was not properly shut
down; automatic recovery in progress 2018-11-08 12:45:25.127 UTC [22]
LOG: redo starts at 0/166CF68 2018-11-08 12:45:25.127 UTC [22] LOG:
invalid record length at 0/166D048: wanted 24, got 0 2018-11-08
12:45:25.127 UTC [22] LOG: redo done at 0/166D010 2018-11-08
12:45:25.259 UTC [22] PANIC: could not rename file
"pg_logical/replorigin_checkpoint.tmp" to
"pg_logical/replorigin_checkpoint": Permission denied 2018-11-08
12:45:25.357 UTC [1] LOG: startup process (PID 22) was terminated by
signal 6: Aborted 2018-11-08 12:45:25.358 UTC [1] LOG: aborting
startup due to startup process failure 2018-11-08 12:45:25.359 UTC [1]
LOG: database system is shut down
Can someone help me to sort it out?
postgresql docker docker-compose pg
closed as off-topic by tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub Nov 9 at 1:32
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
1
down vote
favorite
So, I need docker image with: my program that use postgresql, postgresql and some data in it
I use this article: https://medium.com/@sharmaNK/build-postgres-docker-image-with-data-included-489bd58a1f9e
My steps:
docker-compose build
//Creates ps_image_with_datadocker run --name ps-export -p 5432:5432 -i postgres
- Connect to 5432 db, using dbeaver; create table; put some rows in the table
docker exec -it my_container_with_data_id bash
mkdir /postgres
cp -r /var/lib/postgresql/data/* /postgres
docker commit ps-export ps_image_with_data
docker run --env PGDATA=postgres -p 5432:5432 -i ps_image_with_data
// here I've tried both ps_image_with_data and new image that was created on step 7
And after 8 step I got this:
2018-11-08 12:44:52.549 UTC [1] LOG: listening on IPv4 address
"0.0.0.0", port 5432 2018-11-08 12:44:52.549 UTC [1] LOG: listening
on IPv6 address "::", port 5432 2018-11-08 12:44:52.615 UTC [1] LOG:
listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2018-11-08 12:44:52.750 UTC [22] LOG: database system was
interrupted; last known up at 2018-11-08 11:56:27 UTC 2018-11-08
12:45:25.042 UTC [22] LOG: could not remove cache file
"global/pg_internal.init": Permission denied 2018-11-08 12:45:25.042
UTC [22] LOG: could not remove cache file
"base/13067/pg_internal.init": Permission denied 2018-11-08
12:45:25.042 UTC [22] LOG: database system was not properly shut
down; automatic recovery in progress 2018-11-08 12:45:25.127 UTC [22]
LOG: redo starts at 0/166CF68 2018-11-08 12:45:25.127 UTC [22] LOG:
invalid record length at 0/166D048: wanted 24, got 0 2018-11-08
12:45:25.127 UTC [22] LOG: redo done at 0/166D010 2018-11-08
12:45:25.259 UTC [22] PANIC: could not rename file
"pg_logical/replorigin_checkpoint.tmp" to
"pg_logical/replorigin_checkpoint": Permission denied 2018-11-08
12:45:25.357 UTC [1] LOG: startup process (PID 22) was terminated by
signal 6: Aborted 2018-11-08 12:45:25.358 UTC [1] LOG: aborting
startup due to startup process failure 2018-11-08 12:45:25.359 UTC [1]
LOG: database system is shut down
Can someone help me to sort it out?
postgresql docker docker-compose pg
closed as off-topic by tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub Nov 9 at 1:32
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
So, I need docker image with: my program that use postgresql, postgresql and some data in it
I use this article: https://medium.com/@sharmaNK/build-postgres-docker-image-with-data-included-489bd58a1f9e
My steps:
docker-compose build
//Creates ps_image_with_datadocker run --name ps-export -p 5432:5432 -i postgres
- Connect to 5432 db, using dbeaver; create table; put some rows in the table
docker exec -it my_container_with_data_id bash
mkdir /postgres
cp -r /var/lib/postgresql/data/* /postgres
docker commit ps-export ps_image_with_data
docker run --env PGDATA=postgres -p 5432:5432 -i ps_image_with_data
// here I've tried both ps_image_with_data and new image that was created on step 7
And after 8 step I got this:
2018-11-08 12:44:52.549 UTC [1] LOG: listening on IPv4 address
"0.0.0.0", port 5432 2018-11-08 12:44:52.549 UTC [1] LOG: listening
on IPv6 address "::", port 5432 2018-11-08 12:44:52.615 UTC [1] LOG:
listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2018-11-08 12:44:52.750 UTC [22] LOG: database system was
interrupted; last known up at 2018-11-08 11:56:27 UTC 2018-11-08
12:45:25.042 UTC [22] LOG: could not remove cache file
"global/pg_internal.init": Permission denied 2018-11-08 12:45:25.042
UTC [22] LOG: could not remove cache file
"base/13067/pg_internal.init": Permission denied 2018-11-08
12:45:25.042 UTC [22] LOG: database system was not properly shut
down; automatic recovery in progress 2018-11-08 12:45:25.127 UTC [22]
LOG: redo starts at 0/166CF68 2018-11-08 12:45:25.127 UTC [22] LOG:
invalid record length at 0/166D048: wanted 24, got 0 2018-11-08
12:45:25.127 UTC [22] LOG: redo done at 0/166D010 2018-11-08
12:45:25.259 UTC [22] PANIC: could not rename file
"pg_logical/replorigin_checkpoint.tmp" to
"pg_logical/replorigin_checkpoint": Permission denied 2018-11-08
12:45:25.357 UTC [1] LOG: startup process (PID 22) was terminated by
signal 6: Aborted 2018-11-08 12:45:25.358 UTC [1] LOG: aborting
startup due to startup process failure 2018-11-08 12:45:25.359 UTC [1]
LOG: database system is shut down
Can someone help me to sort it out?
postgresql docker docker-compose pg
So, I need docker image with: my program that use postgresql, postgresql and some data in it
I use this article: https://medium.com/@sharmaNK/build-postgres-docker-image-with-data-included-489bd58a1f9e
My steps:
docker-compose build
//Creates ps_image_with_datadocker run --name ps-export -p 5432:5432 -i postgres
- Connect to 5432 db, using dbeaver; create table; put some rows in the table
docker exec -it my_container_with_data_id bash
mkdir /postgres
cp -r /var/lib/postgresql/data/* /postgres
docker commit ps-export ps_image_with_data
docker run --env PGDATA=postgres -p 5432:5432 -i ps_image_with_data
// here I've tried both ps_image_with_data and new image that was created on step 7
And after 8 step I got this:
2018-11-08 12:44:52.549 UTC [1] LOG: listening on IPv4 address
"0.0.0.0", port 5432 2018-11-08 12:44:52.549 UTC [1] LOG: listening
on IPv6 address "::", port 5432 2018-11-08 12:44:52.615 UTC [1] LOG:
listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2018-11-08 12:44:52.750 UTC [22] LOG: database system was
interrupted; last known up at 2018-11-08 11:56:27 UTC 2018-11-08
12:45:25.042 UTC [22] LOG: could not remove cache file
"global/pg_internal.init": Permission denied 2018-11-08 12:45:25.042
UTC [22] LOG: could not remove cache file
"base/13067/pg_internal.init": Permission denied 2018-11-08
12:45:25.042 UTC [22] LOG: database system was not properly shut
down; automatic recovery in progress 2018-11-08 12:45:25.127 UTC [22]
LOG: redo starts at 0/166CF68 2018-11-08 12:45:25.127 UTC [22] LOG:
invalid record length at 0/166D048: wanted 24, got 0 2018-11-08
12:45:25.127 UTC [22] LOG: redo done at 0/166D010 2018-11-08
12:45:25.259 UTC [22] PANIC: could not rename file
"pg_logical/replorigin_checkpoint.tmp" to
"pg_logical/replorigin_checkpoint": Permission denied 2018-11-08
12:45:25.357 UTC [1] LOG: startup process (PID 22) was terminated by
signal 6: Aborted 2018-11-08 12:45:25.358 UTC [1] LOG: aborting
startup due to startup process failure 2018-11-08 12:45:25.359 UTC [1]
LOG: database system is shut down
Can someone help me to sort it out?
postgresql docker docker-compose pg
postgresql docker docker-compose pg
edited Nov 8 at 13:50
a_horse_with_no_name
286k45429526
286k45429526
asked Nov 8 at 13:29
Mitch
499
499
closed as off-topic by tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub Nov 9 at 1:32
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub Nov 9 at 1:32
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Pearly Spencer, sideshowbarker, Makyen, Paul Roub
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
How about
docker run --name ps-export -p 5432:5432 -i postgres
Connect to 5432 db, using dbeaver; create table; put some rows in the table
Make a dump (
data.sql
) to your hostAdd in your
docker-compose.yml
, under the psql server
`
volumes:
- ./data.sql:/docker-entrypoint-initdb.d/init.sql
docker-compose up
If you want to include data.sql
in the image, instead of step 4, copy it to /docker-entrypoint-initdb.d/init.sql
in your dockerfile.
Thatnks! It didn't work exactly this way, but I changed a little bit and now it's working: - ./data.sql:/docker-entrypoint-initdb.d/data.sql and I added environment to the docker-compose(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
– Mitch
Nov 13 at 10:30
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
How about
docker run --name ps-export -p 5432:5432 -i postgres
Connect to 5432 db, using dbeaver; create table; put some rows in the table
Make a dump (
data.sql
) to your hostAdd in your
docker-compose.yml
, under the psql server
`
volumes:
- ./data.sql:/docker-entrypoint-initdb.d/init.sql
docker-compose up
If you want to include data.sql
in the image, instead of step 4, copy it to /docker-entrypoint-initdb.d/init.sql
in your dockerfile.
Thatnks! It didn't work exactly this way, but I changed a little bit and now it's working: - ./data.sql:/docker-entrypoint-initdb.d/data.sql and I added environment to the docker-compose(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
– Mitch
Nov 13 at 10:30
add a comment |
up vote
2
down vote
accepted
How about
docker run --name ps-export -p 5432:5432 -i postgres
Connect to 5432 db, using dbeaver; create table; put some rows in the table
Make a dump (
data.sql
) to your hostAdd in your
docker-compose.yml
, under the psql server
`
volumes:
- ./data.sql:/docker-entrypoint-initdb.d/init.sql
docker-compose up
If you want to include data.sql
in the image, instead of step 4, copy it to /docker-entrypoint-initdb.d/init.sql
in your dockerfile.
Thatnks! It didn't work exactly this way, but I changed a little bit and now it's working: - ./data.sql:/docker-entrypoint-initdb.d/data.sql and I added environment to the docker-compose(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
– Mitch
Nov 13 at 10:30
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
How about
docker run --name ps-export -p 5432:5432 -i postgres
Connect to 5432 db, using dbeaver; create table; put some rows in the table
Make a dump (
data.sql
) to your hostAdd in your
docker-compose.yml
, under the psql server
`
volumes:
- ./data.sql:/docker-entrypoint-initdb.d/init.sql
docker-compose up
If you want to include data.sql
in the image, instead of step 4, copy it to /docker-entrypoint-initdb.d/init.sql
in your dockerfile.
How about
docker run --name ps-export -p 5432:5432 -i postgres
Connect to 5432 db, using dbeaver; create table; put some rows in the table
Make a dump (
data.sql
) to your hostAdd in your
docker-compose.yml
, under the psql server
`
volumes:
- ./data.sql:/docker-entrypoint-initdb.d/init.sql
docker-compose up
If you want to include data.sql
in the image, instead of step 4, copy it to /docker-entrypoint-initdb.d/init.sql
in your dockerfile.
answered Nov 8 at 13:55
Siyu
881416
881416
Thatnks! It didn't work exactly this way, but I changed a little bit and now it's working: - ./data.sql:/docker-entrypoint-initdb.d/data.sql and I added environment to the docker-compose(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
– Mitch
Nov 13 at 10:30
add a comment |
Thatnks! It didn't work exactly this way, but I changed a little bit and now it's working: - ./data.sql:/docker-entrypoint-initdb.d/data.sql and I added environment to the docker-compose(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
– Mitch
Nov 13 at 10:30
Thatnks! It didn't work exactly this way, but I changed a little bit and now it's working: - ./data.sql:/docker-entrypoint-initdb.d/data.sql and I added environment to the docker-compose(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
– Mitch
Nov 13 at 10:30
Thatnks! It didn't work exactly this way, but I changed a little bit and now it's working: - ./data.sql:/docker-entrypoint-initdb.d/data.sql and I added environment to the docker-compose(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)
– Mitch
Nov 13 at 10:30
add a comment |