Title: WordPress Docker Image breaks REST api because loopback fails
Last modified: April 3, 2020

---

# WordPress Docker Image breaks REST api because loopback fails

 *  [kerrykimrusso](https://wordpress.org/support/users/jooniya/)
 * (@jooniya)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/)
 * My setup (so far) uses docker swarm to run the wordpress:5.4.0-apache image networked
   with a msyql:5.7.29 image for the database. I copied the docker-compose file 
   from the readme on the docker image page. It maps port 8080 on the host port 
   80 for the wordpress container. The issue seems to be that this breaks the REST
   API since it will try to hit localhost:8080 inside the container rather than 
   localhost:80. WordPress reports this in the Tools > Site Health section of the
   dashboard as a critical error:
 * cURL error 7: Failed to connect to localhost port 8080: Connection refused
 * If I change the port mapping to expose 80 to the host, then everything works 
   as expected.
 * Is there a Docker only workaround so that I can expose any port I want to the
   host and still have the loopback call work? Or would any solution require changes
   to wp-config.php or some other wp file?
 * If this is a limitation of using wordpress with docker, then the documentation
   needs to fix the error in the docker-compose file and make a note of this limitation.
   Or if there is a way to use a different port successfully, then that should be
   documented.
 * Other system details:
    – Docker for mac 2.2.0.4 – Docker engine 19.03.8 – Compose
   1.25.4 – macOS catalina 10.15.3
 * Thanks for any help!
    -  This topic was modified 6 years, 1 month ago by [kerrykimrusso](https://wordpress.org/support/users/jooniya/).

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Carike](https://wordpress.org/support/users/carike/)
 * (@carike)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-12624778)
 * You can join the WordPress Slack here:
 * > [Slack](https://make.wordpress.org/chat/)
 * 
    The channel is #core-restapi
 * You may be asked to open a ticket on Core Trac from there.
 *  Thread Starter [kerrykimrusso](https://wordpress.org/support/users/jooniya/)
 * (@jooniya)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-12624859)
 * Thank you for your response, but the slack channel seems to be reserved for contributors
   and not support questions
 * > Slack communication is used for contributing to the WordPress project, be it
   > code, design, documentation, etc….
   > Please note that there is no support channel for WordPress on Slack. The best
   > place to get support is the WordPress.org support forums which are highly active
   > and well maintained.
 * I can take a look at their IRC channel, though they state the best place for 
   support is the forums.
 *  [Carike](https://wordpress.org/support/users/carike/)
 * (@carike)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-12624959)
 * Yes, Slack is reserved for contributing to the WordPress project.
    However, for
   the REST API specifically, only a handful of people can determine if it is necessary
   to update the documentation / whether it is something that the team may want 
   to take on in terms of development and they are available during office hours.
 *  Thread Starter [kerrykimrusso](https://wordpress.org/support/users/jooniya/)
 * (@jooniya)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-12636610)
 * Posted my question in the #core-restapi slack channel and they directed me to
   the forums or the wordpress stack exchange so I posted my question there as well:
   [https://wordpress.stackexchange.com/questions/363381/wordpress-docker-image-breaks-rest-api-because-loopback-fails](https://wordpress.stackexchange.com/questions/363381/wordpress-docker-image-breaks-rest-api-because-loopback-fails)
 *  [Carike](https://wordpress.org/support/users/carike/)
 * (@carike)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-12636672)
 * Jip. The person who answered you on Slack is one of the people who maintain the
   REST API, so they have solid judgement when it comes to this.
 * The question is a bit specialized for the forums though. The question will remain
   here in case someone comes along that can help, but you might have better luck
   on StackExchange for this.
 * Will hold thumbs 🙂
 *  [Tom J Nowell](https://wordpress.org/support/users/tjnowell/)
 * (@tjnowell)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-12636829)
 * The docker image you linked to isn’t an official WP docker image, it’s and maintained
   by Docker themselves without official involvement. You should report to them 
   that they’re missing the loopback, or, update your own docker file to add the
   domain to the hosts file inside the container
 * [https://hub.docker.com/_/wordpress](https://hub.docker.com/_/wordpress)
 *  Thread Starter [kerrykimrusso](https://wordpress.org/support/users/jooniya/)
 * (@jooniya)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-12636903)
 * [@carike](https://wordpress.org/support/users/carike/) ty for your help
 * [@tjnowell](https://wordpress.org/support/users/tjnowell/) I didn’t realize that.
   I’ll take this issue up with them then. Also, unless I’m thinking about this 
   incorrectly, this is a port issue so aliasing a domain in the hosts file wouldn’t
   work in this situation. ty for your reply.
 *  [digitaltech](https://wordpress.org/support/users/digitaltech/)
 * (@digitaltech)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-13109735)
 * >  Is there a Docker only workaround so that I can expose any port I want to 
   > the host and still have the loopback call work?
 * I encountered something similar, and after MUCH searching and experimenting, 
   I stumbled upon [this post](https://wordpress.org/support/topic/what-is-the-url-used-for-the-loopback-curl-check/#post-10850446),
   which solved the issue for me. Maybe it will provide some insights for your situation.
 *  [montrealist](https://wordpress.org/support/users/spectrus/)
 * (@spectrus)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-13126720)
 * Thank you [@digitaltech](https://wordpress.org/support/users/digitaltech/) – 
   this is very useful.
 * No specific solution here but a good read, may help as well: [https://github.com/docker-library/wordpress/issues/493](https://github.com/docker-library/wordpress/issues/493)

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘WordPress Docker Image breaks REST api because loopback fails’ is closed
to new replies.

## Tags

 * [docker](https://wordpress.org/support/topic-tag/docker/)

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 9 replies
 * 5 participants
 * Last reply from: [montrealist](https://wordpress.org/support/users/spectrus/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/wordpress-docker-image/#post-13126720)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
