2

I am having issues with running Adminer on my localhost. After running this command:

$ docker run --rm -ti --network host adminer
[Sun Jan 10 18:19:33 2021] PHP 7.4.14 Development Server (http://[::]:8080) started

I expect to see Adminer running on localhost:8080, however my browser "can't establish a connection to the server at localhost:8080"

Not sure how to proceed from here. My terminal states that the server is running on 8080

Thank you!

Connor Cantrell
  • 119
  • 1
  • 11

1 Answers1

3

If you have to run docker on a virtual machine then I think it's only listening to port 8080 on that VM (which you could check with wget or curl on the VM IP address which you should be able to find using the docker desktop, or you could use the VM console and try wget or curl on http://localhost:8080)

You may need to use -p 8080:8080 instead of --network hostto expose the port on your local machine.

Chris
  • 1,644
  • 1
  • 11
  • 15
  • Ah, but a quick Google jogged a memory. Is this on windows - are you running this on a virtual machine? If so that is where port 8080 is available – Chris Jan 10 '21 at 19:08
  • 1
    Ah, and more reading of documentation suggests that where specifying host network does use the virtual machine, -p does actually expose the port on the actual local machine, so my initial answer may well be correct after all! – Chris Jan 10 '21 at 19:12
  • Thanks Chris! changing to -p 8080:8080 did load Adminer. Now I am receiving the following error when attempting to connect to my database. `SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? could not connect to server: Address not available Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?` – Connor Cantrell Jan 10 '21 at 19:35
  • and I had used this command to start my database: `docker run --rm -ti --network host -e POSTGRES_PASSWORD=secret postgres` – Connor Cantrell Jan 10 '21 at 19:37
  • That makes sense, I was going to ask if you had a postgres container running, as adminer is a separate tool. It may be worth using docker compose here so that you always have both running - check the section about docker- compose on https://hub.docker.com/_/postgres – Chris Jan 10 '21 at 20:23
  • 1
    Glad the port mapping worked -- I remember in the past having problems with network settings and access on local machine but your question made me look into it again and I think I learned something from that – Chris Jan 10 '21 at 20:25