Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker installation error due to existing local Postgres instance on Port 5432 #7800

Closed
3 tasks done
iamraybao opened this issue Jun 30, 2019 · 8 comments
Closed
3 tasks done
Labels
!deprecated-label:bug Deprecated label - Use #bug instead inactive Inactive for >= 30 days

Comments

@iamraybao
Copy link

A clear and concise description of what the bug is.

Expected results

I followed directions to install via docker here: https://superset.incubator.apache.org/installation.html#start-with-docker

Actual results

I got the following error:

> contrib/docker docker-compose run --rm superset ./docker-init.sh
Starting superset_redis_1    ... done
Starting superset_postgres_1 ... error

ERROR: for superset_postgres_1  Cannot start service postgres: driver failed programming external connectivity on endpoint superset_postgres_1 (3380fb75092993fee17b68c6e9a314defed16efb8fdbbe79fd02541462c46ff0): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use

ERROR: for postgres  Cannot start service postgres: driver failed programming external connectivity on endpoint superset_postgres_1 (3380fb75092993fee17b68c6e9a314defed16efb8fdbbe79fd02541462c46ff0): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use
ERROR: Encountered errors while bringing up the project.

I have a local instance of postgres running that supports a airflow deployment. Thus, when I run sudo lsof -i :5432, I get the following output:

sudo lsof -i :5432
COMMAND    PID     USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
postgres 25876 postgres    6u  IPv4 1437703      0t0  TCP localhost:postgresql (LISTEN)

I updated my docker-compose.yml file to this (per these instructions: https://stackoverflow.com/questions/55115080/how-to-specify-different-port-for-a-docker-postgres-instance):

< ... cut from above ... >

      POSTGRES_DB: superset
      POSTGRES_PASSWORD: superset
      POSTGRES_USER: superset
    ports:
      - "5444:5432"
    volumes:
      - postgres:/var/lib/postgresql/data

  superset:
    build:
      context: ../../
      dockerfile: contrib/docker/Dockerfile
    restart: unless-stopped
    environment:
      POSTGRES_DB: superset
      POSTGRES_USER: superset
      POSTGRES_PASSWORD: superset
      POSTGRES_HOST: postgres
      POSTGRES_PORT: 5432
      REDIS_HOST: redis
      REDIS_PORT: 6379
      # If using production, comment development volume below
      #SUPERSET_ENV: production
      SUPERSET_ENV: development

But I am still getting an error when I run docker-compose run --rm superset ./docker-init.sh

What am I doing wrong?

Screenshots

If applicable, add screenshots to help explain your problem.

How to reproduce the bug

See above.

Environment

(please complete the following information): N/A for installation

  • superset version: superset version
  • python version: python --version
  • node.js version: node -v
  • npm version: npm -v

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Add any other context about the problem here.

@issue-label-bot issue-label-bot bot added the !deprecated-label:bug Deprecated label - Use #bug instead label Jun 30, 2019
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.55. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@raman325
Copy link

raman325 commented Jul 9, 2019

You changed the port that Postgres maps to outside of the container in the postgres container block, but in your superset container block, you are still referencing the old port when setting POSTGRES_PORT. Try updating that port to point to your new port (5344)

EDIT: I actually ran into a similar problem and tried this but still ran into problems. I manually went into the postgres.conf file and changed the port, uncommented it, and updated the docker-compose to what would be 5344:5344 for you. That seemed to get things running, although my user/pass combo isn't working so I will have to troubleshoot more tomorrow

@raman325
Copy link

raman325 commented Jul 9, 2019

Just confirmed. If I were to redo this, I would:

  • First update the docker-compose.yaml files to refer to the new port mapping for both the Postgres image and the environment variable for superset. Note that I made the source and destination port the same (5344:5344)
  • Next I'd run the initialization docker-compose command which would build the images, containers, and attempt to set up superset but fail
  • Then I'd update postgresql.conf (I made this easy by changing the volume references to be on the host system so data could persist) to uncomment the port parameter and update it to 5344
  • Then I'd rerun the initialization docker-compose command which would succeed and finish setting up the DB
  • Then I'd run docker-compose up and if I extracted all of the clean steps correctly out of my messy process I used to get to a running system, you should be good to go

@icoert
Copy link

icoert commented Jul 22, 2019

You shoud find the PID of the process with the local address that you are looking for.

netstat -a -n -o

Then, it remains to kill the process.

taskkill /F /PID <PID_NUMBER>

It's possible to not work without an administrative command prompt.

@jnthnvctr
Copy link

jnthnvctr commented Aug 5, 2019

Hi - I'm running into this issue as well, not sure if I'm doing something totally insane.

I'm trying to follow the instructions for setting up superset with some sample data using the steps provided in the tutorial.

I locally installed postgres and have gotten all the weather data loaded per this. When I try running docker-compose up I get errors from superset saying the port is in use.

I tried running @raman325 's steps, but still seem to have an issue. To confirm that I'm running the steps correctly:

  1. In the locally installed postgresql.conf I should uncomment and edit the port parameter to be 5344 ( or any number really).

  2. In the docker-compose.yml, I should edit the port parameter so the local port matches the number choice in (1). If I picked 5344 above, I use that as the first number here. The internal mapping number for docker (the second number should be 5342).

  3. If I had edited the second number to be something other than 5342, I should make sure the POSTGRES PORT parameter in the superset block is the same as the second number I've chosen.

  4. If I've done the above correctly, I should be able to have my local postgres running, as well as superset and connect the two, right?

What I'm seeing now is new errors from docker saying that it can't connect at the docker IP address for the new port. Is that something else that needs to be configured?

@raman325
Copy link

raman325 commented Aug 5, 2019

For step 2, you need to use 5344 for the second number/port too. The second port is the container port, and by changing postgresql.conf, you've changed the port that postgres is listening to within the container.

The POSTGRES PORT in the superset block should be the same port as the first number, as that is the one exposed to the world (e.g. outside the container)

@stale
Copy link

stale bot commented Oct 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Oct 4, 2019
@stale stale bot closed this as completed Oct 11, 2019
@mona-mk
Copy link

mona-mk commented Jan 10, 2021

Trying to do what @jnthnvctr is doing:

  • weather db running locally on the default port 5432 (i.e. following these two tutorials: weather-db & superset-tutorial
  • Running superset locally (& planning to connect the weather db to superset later)

The only change I made:

  • in docker-compose.yml, changed the host port to sth else (here 5433 - see attached). Superset is now running locally fine, and connected fine also to the locally running weather db

I am running superset version 0.38.0, and btw there is no more POSTGRES_PORT variable in current version, so no need for this step.
Screenshot 2021-01-10 at 20 23 33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

5 participants