Docker Compose for WordPress - Unable to connect

Learning to use containers. Looking for troubleshooting advice. Where in /var/log should there be detail of what is not working?

Using https://www.linode.com/docs/quick-answers/linux/wordpress-with-docker-compose/ for CentOS 7.

"docker run hello-world" seemed fine:
Hello from Docker!
This message shows that your installation appears to be working correctly.

"docker-compose up -d" seemed fine:
Creating network "personalwordpressdefault" with the default driver
Creating volume "personalwordpresswordpressfiles" with default driver Creating personalwordpressdb1 … done
Creating personalwordpresswordpress_1 … done

"docker ps" seemed fine:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b3e39745c54d wordpress:latest "docker-entrypoint.s…" About an hour ago Restarting (1) 26 minutes ago personalwordpresswordpress1 44955b4a33ab mysql:5.7 "docker-entrypoint.s…" About an hour ago Up About an hour 3306/tcp personalwordpressdb1

"sudo systemctl status -l firewalld" had an error.
firewalld ERROR: Calling post func <function 0x7f1e0bd3eaa0="" at="" ifcfg_set_zone_of_interface="">(('public', 'eth0')) failed: [Errno 13] Permission denied: '/etc/sysconfig/network-scripts/ifcfg-eth0'</function>

w3m: Can't load either.

2 Replies

Some more details on the firewalld status, and a resolution, can be found here:

Linode Community - How do i give permission to firewalld's "ifcfg-eth0" ? [SOLVED]

To get some more details on the current state of things, the following output would be helpful.

$ sudo ss -tlpn

And once you get firewalld up and running, you can find the active zones:

$ sudo firewall-cmd --get-active-zones

The output of the following for the active zones would also be helpful.

# sudo firewall-cmd --zone=public --list-all

I would also encourage you to review the following logs to look more into SELinux and what is going on in your containers for signs of issues.

$ sudo less /var/log/audit/audit.log
$ cd /directory/with/compose/file
$ docker-compose logs -f

Output of sudo ss -tlpn:
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:* users:(("sshd",pid=727,fd=3))
LISTEN 0 10 127.0.0.1:25 : users:(("sendmail",pid=16855,fd=4))
LISTEN 0 :::80 :::* users:(("docker-proxy",pid=16879,fd=4))
LISTEN 0 :::22 :::* users:(("sshd",pid=727,fd=4))

sudo firewall-cmd --get-active-zones:
public
interfaces: eth0 vethff8d9d2 veth81029fc …veth Pages like that.

sudo firewall-cmd --zone=public --list-all:
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0 vethff8d9d2 …veth Pages like that.
sources:
services: ssh dhcpv6-client https
ports: 8000/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

docker-compose logs -f:
Attaching to personalwordpresswordpress1, personalwordpressdb1
wordpress1 | WordPress not found in /var/www/html - copying now… wordpress1 | Complete! WordPress has been successfully copied to /var/www/html
wordpress1 | wordpress1 | Warning: mysqli::construct(): (HY000/1045): Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) in Standard input code on line 22 wordpress1 | wordpress1 | MySQL Connection Error: (1045) Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) wordpress1 | wordpress1 | Warning: mysqli::construct(): (HY000/1045): Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) in Standard input code on line 22
wordpress1 | wordpress1 | MySQL Connection Error: (1045) Access denied for user 'wordpress'@'172.18.0.3' (using password: YES)
wordpress1 | wordpress1 | Warning: mysqli::construct(): (HY000/1045): Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) in Standard input code on line 22 wordpress1 | wordpress1 | MySQL Connection Error: (1045) Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) wordpress1 | wordpress1 | Warning: mysqli::construct(): (HY000/1045): Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) in Standard input code on line 22
… no end to log.

sudo tail -n 60 /var/log/audit/audit.log:

type=NETFILTERCFG msg=audit(1535243316.069:644484): table=raw family=10 entries=10771 type=SYSCALL msg=audit(1535243316.069:644484): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=29 a2=40 a3=275cbc0 items=0 ppid=17496 pid=30265 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ip6tables-resto" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null)
type=PROCTITLE msg=audit(1535243316.069:644484): proctitle=2F7573722F7362696E2F6970367461626C65732D726573746F7265002D2D776169743D32002D6E
type=NETFILTERCFG msg=audit(1535243316.080:644485): table=mangle family=10 entries=10781 type=SYSCALL msg=audit(1535243316.080:644485): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=29 a2=40 a3=275d810 items=0 ppid=17496 pid=30265 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ip6tables-resto" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null)
type=PROCTITLE msg=audit(1535243316.080:644485): proctitle=2F7573722F7362696E2F6970367461626C65732D726573746F7265002D2D776169743D32002D6E
type=NETFILTERCFG msg=audit(1535243316.100:644486): table=nat family=10 entries=21534 type=SYSCALL msg=audit(1535243316.100:644486): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=29 a2=40 a3=2c73c10 items=0 ppid=17496 pid=30265 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ip6tables-resto" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null)
type=PROCTITLE msg=audit(1535243316.100:644486): proctitle=2F7573722F7362696E2F6970367461626C65732D726573746F7265002D2D776169743D32002D6E
type=AVC msg=audit(1535243316.118:644487): avc: denied { read } for pid=17496 comm="firewalld" name="ifcfg-eth0" dev="sda" ino=13 scontext=systemu:systemr:firewalldt:s0 tcontext=systemu:objectr:unlabeledt:s0 tclass=file
type=SYSCALL msg=audit(1535243316.118:644487): arch=c000003e syscall=2 success=no exit=-13 a0=d825e0 a1=0 a2=1b6 a3=24 items=0 ppid=1 pid=17496 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="firewalld" exe="/usr/bin/python2.7" subj=systemu:systemr:firewalldt:s0 key=(null) type=PROCTITLE msg=audit(1535243316.118:644487): proctitle=2F7573722F62696E2F707974686F6E002D4573002F7573722F7362696E2F6669726577616C6C64002D2D6E6F666F726B002D2D6E6F706964 type=NETFILTERCFG msg=audit(1535243316.233:644488): table=filter family=2 entries=32334
type=SYSCALL msg=audit(1535243316.233:644488): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=7f949b39e010 items=0 ppid=17496 pid=30273 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.233:644488): proctitle=2F7573722F7362696E2F69707461626C6573002D7732002D740066696C746572002D4100444F434B45520000002D690062722D373830306136663736363138002D6F0062722D373830306136663736363138002D7000746370002D64003137322E31382E302E32002D2D64706F7274003830002D6A00414343455054 type=NETFILTERCFG msg=audit(1535243316.298:644489): table=nat family=2 entries=21545
type=SYSCALL msg=audit(1535243316.298:644489): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=7f3abd7f7010 items=0 ppid=17496 pid=30279 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.298:644489): proctitle=2F7573722F7362696E2F69707461626C6573002D7732002D74006E6174002D4100504F5354524F5554494E47002D7000746370002D73003137322E31382E302E32002D64003137322E31382E302E32002D2D64706F7274003830002D6A004D415351554552414445 type=NETFILTERCFG msg=audit(1535243316.366:644490): table=filter family=2 entries=0
type=NETFILTERCFG msg=audit(1535243316.366:644490): table=nat family=2 entries=0 type=NETFILTERCFG msg=audit(1535243316.366:644490): table=filter family=10 entries=0
type=NETFILTERCFG msg=audit(1535243316.366:644490): table=raw family=2 entries=0 type=NETFILTERCFG msg=audit(1535243316.366:644490): table=security family=2 entries=0
type=NETFILTERCFG msg=audit(1535243316.366:644490): table=mangle family=2 entries=0 type=NETFILTERCFG msg=audit(1535243316.366:644490): table=raw family=10 entries=0
type=NETFILTERCFG msg=audit(1535243316.366:644490): table=security family=10 entries=0 type=NETFILTERCFG msg=audit(1535243316.366:644490): table=mangle family=10 entries=0
type=NETFILTERCFG msg=audit(1535243316.366:644490): table=nat family=10 entries=0 type=SYSCALL msg=audit(1535243316.366:644490): arch=c000003e syscall=272 success=yes exit=0 a0=6c020000 a1=558434964c7f a2=0 a3=7ffc18577e20 items=0 ppid=30292 pid=30298 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="runc:[1:CHILD]" exe="/usr/bin/docker-runc" subj=systemu:systemr:containerruntimet:s0 key=(null) type=PROCTITLE msg=audit(1535243316.366:644490): proctitle=646F636B65722D72756E6300696E6974 type=NETFILTERCFG msg=audit(1535243316.532:644491): table=nat family=2 entries=5
type=SYSCALL msg=audit(1535243316.532:644491): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=98c720 items=0 ppid=30318 pid=30329 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.532:644491): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D4E00444F434B45525F4F5554505554 type=NETFILTERCFG msg=audit(1535243316.533:644492): table=nat family=2 entries=7
type=SYSCALL msg=audit(1535243316.533:644492): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=afd060 items=0 ppid=30318 pid=30330 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.533:644492): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D49004F5554505554002D64003132372E302E302E3131002D6A00444F434B45525F4F5554505554 type=NETFILTERCFG msg=audit(1535243316.535:644493): table=nat family=2 entries=8
type=SYSCALL msg=audit(1535243316.535:644493): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=1942a70 items=0 ppid=30318 pid=30332 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.535:644493): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D4E00444F434B45525F504F5354524F5554494E47 type=NETFILTERCFG msg=audit(1535243316.536:644494): table=nat family=2 entries=10
type=SYSCALL msg=audit(1535243316.536:644494): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=1ae03b0 items=0 ppid=30318 pid=30333 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.536:644494): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D4900504F5354524F5554494E47002D64003132372E302E302E3131002D6A00444F434B45525F504F5354524F5554494E47 type=NETFILTERCFG msg=audit(1535243316.537:644495): table=nat family=2 entries=11
type=SYSCALL msg=audit(1535243316.537:644495): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=18715b0 items=0 ppid=30318 pid=30334 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.537:644495): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D4900444F434B45525F4F5554505554002D64003132372E302E302E3131002D7000756470002D2D64706F7274003533002D6A00444E4154002D2D746F2D64657374696E6174696F6E003132372E302E302E31313A3339393833 type=NETFILTERCFG msg=audit(1535243316.539:644496): table=nat family=2 entries=12
type=SYSCALL msg=audit(1535243316.539:644496): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=22727b0 items=0 ppid=30318 pid=30335 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.539:644496): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D4900444F434B45525F504F5354524F5554494E47002D73003132372E302E302E3131002D7000756470002D2D73706F7274003339393833002D6A00534E4154002D2D746F2D736F75726365003A3533 type=NETFILTERCFG msg=audit(1535243316.540:644497): table=nat family=2 entries=13
type=SYSCALL msg=audit(1535243316.540:644497): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=aa2a40 items=0 ppid=30318 pid=30336 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.540:644497): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D4900444F434B45525F4F5554505554002D64003132372E302E302E3131002D7000746370002D2D64706F7274003533002D6A00444E4154002D2D746F2D64657374696E6174696F6E003132372E302E302E31313A3339343731 type=NETFILTERCFG msg=audit(1535243316.541:644498): table=nat family=2 entries=14
type=SYSCALL msg=audit(1535243316.541:644498): arch=c000003e syscall=54 success=yes exit=0 a0=4 a1=0 a2=40 a3=8d5c40 items=0 ppid=30318 pid=30337 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="iptables" exe="/usr/sbin/xtables-multi" subj=systemu:systemr:iptablest:s0 key=(null) type=PROCTITLE msg=audit(1535243316.541:644498): proctitle=2F7573722F7362696E2F69707461626C6573002D2D77616974002D74006E6174002D4900444F434B45525F504F5354524F5554494E47002D73003132372E302E302E3131002D7000746370002D2D73706F7274003339343731002D6A00534E4154002D2D746F2D736F75726365003A3533 type=SERVICESTOP msg=audit(1535243325.850:644499): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=systemu:systemr:initt:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' type=USERAUTH msg=audit(1535243337.001:644500): pid=30404 uid=1000 auid=1000 ses=4735 subj=unconfinedu:unconfinedr:unconfinedt:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pamunix acct="davida" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
type=USERACCT msg=audit(1535243337.005:644501): pid=30404 uid=1000 auid=1000 ses=4735 subj=unconfinedu:unconfinedr:unconfinedt:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pamunix,pamlocaluser acct="davida" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
type=USERCMD msg=audit(1535243337.007:644502): pid=30404 uid=1000 auid=1000 ses=4735 subj=unconfinedu:unconfinedr:unconfinedt:s0-s0:c0.c1023 msg='cwd="/home/davida" cmd=7461696C202D6E203630202F7661722F6C6F672F61756469742F61756469742E6C6F67 terminal=pts/0 res=success'
type=CREDREFR msg=audit(1535243337.007:644503): pid=30404 uid=0 auid=1000 ses=4735 subj=unconfinedu:unconfinedr:unconfinedt:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pamunix acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success' type=USERSTART msg=audit(1535243337.010:644504): pid=30404 uid=0 auid=1000 ses=4735 subj=unconfinedu:unconfinedr:unconfinedt:s0-s0:c0.c1023 msg='op=PAM:sessionopen grantors=pamkeyinit,pamlimits acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct