Comments (6)
Where did you see docker-compose is removing links?
docker is removing legacy container links https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/
I believe links are still there, just now with the network. On the docker-compose links reference page:
Links also express dependency between services in the same way as depends_on, so they determine the order of service startup.
Note: If you define both links and networks, services with links between them must share at least one network in common in order to communicate.
So links is still used, and used to determine startup order. So if web links to postgres then running web will also start postgres first.
# built the containers if needed
$ docker-compose -f production.yml build
# migrate if needed, will automatically start postgres, run this if pulling new migrations down
$ docker-compose -f production.yml run web python -u manage.py migrate
# start up anything that hasn't already started
$ docker-compose -f production.yml up -d
Note if postgres is restart always, it will be started anyway.
For windows/mac users the migrate command needs to be:
# windows/mac users have to run in detach mode
$ docker-compose -f production.yml run -d web python -u manage.py migrate --noinput
# but you can still monitor progress
$ docker-compose logs <containername>
from dockerizing-django.
You would at least need to get Postgres up before running the migrations if you handle it that way.
from dockerizing-django.
With the links in compose it will start the postgres container when you run the web container to do the migrate.
If you don't do the migrate first AND there are new migrations it might error on startup until you run migrate. For example if you have pulled new migrations down from in a team.
from dockerizing-django.
Your suggestion is to remove the links and then run the commands in this order? @oppianmatt
$ docker-compose -f production.yml build
$ docker-compose -f production.yml run web python -u manage.py migrate
$ docker-compose -f production.yml up -d
from dockerizing-django.
no keep the links but do the run migrate first. It will start up postgres as needed and apply any migrations that might be in the source and not in the db.
from dockerizing-django.
I believe Docker is removing links altogether in the next release. May be worth removing them now. Also the DB would have to be up, so the commands would need to be:
$ docker-compose -f production.yml build
$ docker-compose -f production.yml up postgres -d
$ docker-compose -f production.yml run web python -u manage.py migrate
$ docker-compose -f production.yml up -d
from dockerizing-django.
Related Issues (20)
- Web in continuous restart loop, can't connect to server HOT 1
- docker-compose v2 one day ?
- standard admin page? HOT 4
- volume: loop restarting web container
- postgres conflict (5432: bind: address already in use) HOT 1
- postgres .env HOT 8
- gunicorn: no such file or directory
- Web address error - didn't send any data
- How do I run database migrations after model changes? HOT 1
- Logging output
- Request: Add these new features please
- initial migration for todo app should be done before run migrate HOT 2
- SessionAuthentiationMiddleware error HOT 1
- Please add a license!
- Serving of /static in production is not working. HOT 3
- /usr/src/app/static doesn't copy across from local HOT 1
- Programming Error relation "todo_item" does not exist HOT 1
- Problem with SSL
- "ProgrammingError at /" raised for line 17 of apps/todo/templates/_base.html file HOT 1
- Absolute URLs without port
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockerizing-django.