3
respostas

Não consigo acessar o meu contrainer wordpress no navegador

Criei os dois contrainer conforme os passo-a-passo do curso. O contrainer do mysql e o contrainer do wordpress. ambos estão rodando. Porem ao tentar acessar no navegador o contrainer do wordpress o mesmo não localiza nada no endereço https://localhost:8080.

Ao inspecionar o contrainer do wordpress criado verifiquei que ele esta rodando na porta 8080 porem o atributo "HostIp" está vazio, sem informação. Não sei o que pode ser.

Segue abaixo o resultado do comando docker inspect blog-alura [ { "Id": "5a47b273160e5f751b1d24a4ddbc2051e582d83a7b60336fbcab05187ebb4c61", "Created": "2017-06-12T15:35:43.362938736Z", "Path": "docker-entrypoint.sh", "Args": [ "apache2-foreground" ], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 5033, "ExitCode": 0, "Error": "", "StartedAt": "2017-06-12T15:35:44.021598989Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:c8fc64de4cb3989207b05de18bd4eb5e711c760842d12add99134da1778c2630", "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/5a47b273160e5f751b1d24a4ddbc2051e582d83a7b60336fbcab05187ebb4c61/resolv.conf", "HostnamePath": "/mnt/sda1/var/lib/docker/containers/5a47b273160e5f751b1d24a4ddbc2051e582d83a7b60336fbcab05187ebb4c61/hostname", "HostsPath": "/mnt/sda1/var/lib/docker/containers/5a47b273160e5f751b1d24a4ddbc2051e582d83a7b60336fbcab05187ebb4c61/hosts", "LogPath": "/mnt/sda1/var/lib/docker/containers/5a47b273160e5f751b1d24a4ddbc2051e582d83a7b60336fbcab05187ebb4c61/5a47b273160e5f751b1d24a4ddbc2051e582d83a7b60336fbcab05187ebb4c61-json.log", "Name": "/blog-alura", "RestartCount": 0, "Driver": "aufs", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": null, "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "default", "PortBindings": { "80/tcp": [ { "HostIp": "", "HostPort": "8080" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "", "Cgroup": "", "Links": [ "/database:/blog-alura/mysql" ], "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 25, 164 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DeviceCgroupRules": null, "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Data": null, "Name": "aufs" }, "Mounts": [ { "Type": "volume", "Name": "932fd79c2d2e9d6ff39e96fcbf1f965a1f0f5f2cfc43c602cafa4e194aa0da74", "Source": "/mnt/sda1/var/lib/docker/volumes/932fd79c2d2e9d6ff39e96fcbf1f965a1f0f5f2cfc43c602cafa4e194aa0da74/_data", "Destination": "/var/www/html", "Driver": "local", "Mode": "", "RW": true, "Propagation": "" } ], "Config": { "Hostname": "5a47b273160e", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "80/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "WODPRESS_DB_PASSWORD=teste123", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tlibpcre3-dev \t\tmake \t\tpkg-config \t\tre2c", "PHP_INI_DIR=/usr/local/etc/php", "APACHE_CONFDIR=/etc/apache2", "APACHE_ENVVARS=/etc/apache2/envvars", "PHP_EXTRA_BUILD_DEPS=apache2-dev", "PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2", "PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2", "PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2", "PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie", "GPG_KEYS=0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3", "PHP_VERSION=5.6.30", "PHP_URL=https://secure.php.net/get/php-5.6.30.tar.xz/from/this/mirror", "PHP_ASC_URL=https://secure.php.net/get/php-5.6.30.tar.xz.asc/from/this/mirror", "PHP_SHA256=a363185c786432f75e3c7ff956b49c3369c3f6906a6b10459f8d1ddc22f70805", "PHP_MD5=68753955a8964ae49064c6424f81eb3e", "WORDPRESS_VERSION=4.8", "WORDPRESS_SHA1=3738189a1f37a03fb9cb087160b457d7a641ccb4" ], "Cmd": [ "apache2-foreground" ], "ArgsEscaped": true, "Image": "wordpress", "Volumes": { "/var/www/html": {} }, "WorkingDir": "/var/www/html", "Entrypoint": [ "docker-entrypoint.sh" ], "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "464551c94c332122dbfd16ccebcbfd6f525f57ff0fb62706966b8b81be5512c0", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "80/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "8080" } ] }, "SandboxKey": "/var/run/docker/netns/464551c94c33", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "394d1579c42154becf03db1d23d77d5d887081772f3f5e41c1cb3fb6863deb90", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.3", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:03", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "afb418291a98a6db32e0b178b888d5bf55ead38db280763b1234a7c9861be24b", "EndpointID": "394d1579c42154becf03db1d23d77d5d887081772f3f5e41c1cb3fb6863deb90", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.3", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:03" } } } } ]

3 respostas

Olá,

Você tem certeza que está rodando na porta 8080 ?

Pelo que vi no exercício, o container é executado com o seguinte comando:

docker run --name blog-alura --link database:mysql -e WORDPRESS_DB_PASSWORD=teste123 -p 80:80 -d wordpress

E basta abrir o seu ip no navegador para utilizar automaticamente a porta 80: http://localhost

Lembrando que esse 80:80 não é 8080, pois um é a porta do serviço dentro do container e a outra é a porta exposta para acesso.

Até mais.

Boa noite,

Também não consegui rodar o wordpress mesmo digitando os comandos conforme exibido no curso.

Comandos:

MacBook:~ jhosef $ docker run --name database -e MYSQL_ROOT_PASSWORD=teste123 -d mysql
12ab944a6ea14a4e129167087bb61b1e5736770d3aa8c54d080ba27ea990d733
MacBook:~ jhosef $ docker run --name blog-alura --link database:mysql -e WORDPRESS_DB_PASSWORD=teste123 -p 80:80 -d wordpress
e3ad871317d97c32373debfb8c58ab26706502fe0a605726af1b32d1b0d97626
MacBook:~ jhosef $ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
e3ad871317d9        wordpress           "docker-entrypoint..."   29 seconds ago      Up 28 seconds       0.0.0.0:80->80/tcp   blog-alura
12ab944a6ea1        mysql               "docker-entrypoint..."   37 seconds ago      Up 36 seconds       3306/tcp             database
MacBook:~ jhosef $

Alguma sugestão de onde pode estar o problema? Alguma teste que eu possa fazer?

Bom dia, consegui acessar o container, no meu caso (Mac), o virtualbox acabou criando uma outra rede virtual com outra faixa de ip.

MacBook:~ jhosef $ ifconfig
...
vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00 
    inet 192.168.99.1 netmask 0xffffff00 broadcast 192.168.99.255

Baseado nisso eu acessei pelo link / ip e consegui acessar o wordpress do container.

http://192.168.99.100/