vchaptsev / cookiecutter-django-vue

Cookiecutter Django Vue is a template for Django-Vue projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bind for 0.0.0.0:3000 failed: port is already allocated

vladimirmyshkovski opened this issue · comments

Hello.

When I often restart my django project, I encounter an error.

I understand that this is due to the contents of the yml file, but I have not yet been able to understand the reason for this error.

ERROR: for 76e7ecc8980b_76e7ecc8980b_projectname_webpack_1  Cannot start service webpack: b'driver failed programming external connectivity on endpoint projectname_webpack_1 (52362b93ab503dd4902e842c35db1730eaa5959d69c62e2b54dfa2c15ffe2088): Bind for 0.0.0.0:3000 failed: port is already allocated'

ERROR: for webpack  Cannot start service webpack: b'driver failed programming external connectivity on endpoint projectname_webpack_1 (52362b93ab503dd4902e842c35db1730eaa5959d69c62e2b54dfa2c15ffe2088): Bind for 0.0.0.0:3000 failed: port is already allocated'
ERROR: Encountered errors while bringing up the project.

Hey!

It looks like you already have another project running on the same port

example: you have 2 projects (pr_1 and pr_2)

$ cd pr_1
$ docker-compose up
$ cd pr_2
$ docker-compose up  # error

But you can stop pr_1 and then run pr_2:

$ cd pr_1
$ docker-compose down
$ cd pr_2
$ docker-compose up  # no error

You can list all running networks, containers, etc:

$ docker network ls
$ docker container ls

Please tell me if this resolved the problem

I understand why the error occurs. The problem is a bit different.
After I turn on my computer, I see how I run a container with a webpack, even though I did not run the Django application.

The problem, it seems to me, is the incorrect configuration of the .yml file. Perhaps this is caused by restart: always.

Hmm. I cannot reproduce this.
Anyway, since it can be fixed by a simple restart, I see no reason to waste time on this