4

I ran centos:7.1.1503 and then yum install postgresql. Unfortunately, due to systemd problems I cannot run service postgresql start even after installing initscripts:

Redirecting to /bin/systemctl start  postgresql.service
/usr/sbin/service: line 79: /bin/systemctl: No such file or directory
[root@8109c497195b ~]# yum provides systemctl  
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos2.hti.pl
 * extras: centos.komster.pl
 * updates: centos2.hti.pl
systemd-208-20.el7.x86_64 : A System and Service Manager
Repo        : base
Matched from:
Filename    : /bin/systemctl



systemd-208-20.el7_1.2.x86_64 : A System and Service Manager
Repo        : updates
Matched from:
Filename    : /bin/systemctl



systemd-208-20.el7_1.3.x86_64 : A System and Service Manager
Repo        : updates
Matched from:
Filename    : /bin/systemctl



systemd-208-20.el7_1.5.x86_64 : A System and Service Manager
Repo        : updates
Matched from:
Filename    : /bin/systemctl



systemd-208-20.el7.x86_64 : A System and Service Manager
Repo        : base
Matched from:
Filename    : /usr/bin/systemctl



systemd-208-20.el7_1.2.x86_64 : A System and Service Manager
Repo        : updates
Matched from:
Filename    : /usr/bin/systemctl



systemd-208-20.el7_1.3.x86_64 : A System and Service Manager
Repo        : updates
Matched from:
Filename    : /usr/bin/systemctl



systemd-208-20.el7_1.5.x86_64 : A System and Service Manager
Repo        : updates
Matched from:
Filename    : /usr/bin/systemctl



[root@8109c497195b ~]# yum install systemd     
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos2.hti.pl
 * extras: centos.komster.pl
 * updates: centos2.hti.pl
Resolving Dependencies
--> Running transaction check
---> Package systemd.x86_64 0:208-20.el7_1.5 will be installed
--> Processing Dependency: libcryptsetup.so.4(CRYPTSETUP_1.0)(64bit) for package: systemd-208-20.el7_1.5.x86_64
--> Processing Dependency: dbus for package: systemd-208-20.el7_1.5.x86_64
--> Processing Dependency: acl for package: systemd-208-20.el7_1.5.x86_64
--> Processing Dependency: libwrap.so.0()(64bit) for package: systemd-208-20.el7_1.5.x86_64
--> Processing Dependency: libqrencode.so.3()(64bit) for package: systemd-208-20.el7_1.5.x86_64
--> Processing Dependency: libcryptsetup.so.4()(64bit) for package: systemd-208-20.el7_1.5.x86_64
--> Running transaction check
---> Package acl.x86_64 0:2.2.51-12.el7 will be installed
---> Package cryptsetup-libs.x86_64 0:1.6.6-3.el7 will be installed
--> Processing Dependency: fipscheck-lib(x86-64) >= 1.3.0 for package: cryptsetup-libs-1.6.6-3.el7.x86_64
--> Processing Dependency: libfipscheck.so.1()(64bit) for package: cryptsetup-libs-1.6.6-3.el7.x86_64
---> Package dbus.x86_64 1:1.6.12-11.el7 will be installed
---> Package qrencode-libs.x86_64 0:3.4.1-3.el7 will be installed
---> Package tcp_wrappers-libs.x86_64 0:7.6-77.el7 will be installed
--> Running transaction check
---> Package fipscheck-lib.x86_64 0:1.4.1-5.el7 will be installed
--> Processing Dependency: /usr/bin/fipscheck for package: fipscheck-lib-1.4.1-5.el7.x86_64
--> Running transaction check
---> Package fipscheck.x86_64 0:1.4.1-5.el7 will be installed
--> Processing Conflict: fakesystemd-1-17.el7.centos.noarch conflicts systemd
--> Finished Dependency Resolution
Error: fakesystemd conflicts with systemd-208-20.el7_1.5.x86_64
 You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
fakesystemd-1-17.el7.centos.noarch has installed conflicts systemd: fakesystemd-1-17.el7.centos.noarch

What can I do now? I'm considering building it from scratch and working this way.

3
  • 1
    You might want to uninstall fakesystemd before trying to install systemd. – womble Sep 8 '15 at 19:38
  • "systemd problems"? Looks like docker does something wacky with an incomplete replacement wrapper for systemd that presumably lacks provides: systemd – Craig Ringer Sep 9 '15 at 0:44
  • The best thing is to run the postgresql process directly. But, if you want systemd running (if you need multiple services started), check this link: developerblog.redhat.com/2014/05/05/… – cristi Nov 8 '15 at 22:50
9

Don't bother with systemd, run Postgres directly. The following shows how to get Postgres running inside a base Centos7 container:

$ docker run -it centos:centos7 /bin/bash
bash-4.2$ yum install postgresql-server sudo
[..snip..]
bash-4.2$ sudo -u postgres /usr/bin/initdb /var/lib/pgsql/data/
bash-4.2$ sudo -u postgres /usr/bin/pg_ctl start \
   -D /var/lib/pgsql/data -s -o "-p 5432" -w -t 300
bash-4.2$ ps -eo pid,args
  PID COMMAND
    1 /bin/bash
  118 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432
  119 postgres: logger process   
  121 postgres: checkpointer process   
  122 postgres: writer process   
  123 postgres: wal writer process   
  124 postgres: autovacuum launcher process   
  125 postgres: stats collector process  

You can put that into a Dockerfile to make it re-usable.

0

https://hub.docker.com/r/centos/postgresql-10-centos7

I using command down here...

--restart="always"

option means always start when docker starting.

docker run -d --name postgresql --restart="always" \
        -e POSTGRESQL_USER=<yourId> \
        -e POSTGRESQL_PASSWORD=<yourPwd> \
        -e POSTGRESQL_DATABASE=<yourDbName> \
        -e POSTGRESQL_ADMIN_PASSWORD=<postgres's Password> \
        -p 5432:5432 centos/postgresql-10-centos7

try it.~

1
  • This solution doesn't help when one want to run off another centos based image. It would be better if you explain and detail how it's done (in the existing image you suggest) so that one can actually implement it in his own image. – Eric Mar 31 '20 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.