Run Saleor with Docker
This doesn't happen every time. Cann't specify the conditions.

System information
Operating system: macOS High Sierra Version: 10.13.6
The problem is that docker-compose is set to restart all containers so unless you explicitly pass --rm to docker run, both the populatedb and the collectstatic commands will be executed over and over again.
@patrys Can we fix that in Dockerfile or docker-compose config?
Yes, I'd suggest to start by dropping all restart: unless-stopped or at the very least change them to restart: on-failure .
The choices really are:
restart: "no"options:
restart: "no"
restart: always
restart: on-failure
restart: unless-stopped
removing restart: will default to "no"
or
docker-compose run --rm web python3 manage.py migrate instead of docker-compose run web python3 manage.py migrateor
docker-compose exec web python3 manage.py migrate or similar docker-compose exec bash -c 'python3 manage.py migrate'
Note that we should always provide examples using --rm when using docker-compose run as skipping it will result in leftover junk even when restarting is disabled.
This issue should be already resolved, using --rm has been documented.
Most helpful comment
Note that we should always provide examples using
--rmwhen usingdocker-compose runas skipping it will result in leftover junk even when restarting is disabled.