wordpress-nginx-docker-compose
wordpress-nginx-docker-compose copied to clipboard
Cannot create container for service - many of them
After following the setup instructions, I've successfully installed it using docker-compose run composer create-project
.
Then, in the next step, to run the containers, docker complains about the name of the containers:
Creating -composer ... error
ERROR: for -composer Cannot create container for service composer: Invalid container name (-composer), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
ERROR: for mailhog Cannot create container for service mailhog: Invalid container name (-mailhog), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
ERROR: for mysql Cannot create container for service mysql: Invalid container name (-mysql), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
ERROR: for composer Cannot create container for service composer: Invalid container name (-composer), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
the thing is the composer can't find the environment variables set in .env
file and it defaults to a blank string:
WARNING: The APP_NAME variable is not set. Defaulting to a blank string.
WARNING: The DOMAIN variable is not set. Defaulting to a blank string.
WARNING: The DB_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
How to make it work?
PS: Sorry about the off-topic. In the step of adding the domain to the hosts file, I've overridden the old entry:
127.0.0.1 localhost
to
127.0.0.1 myapp.local
Is that correct, or should I just add another entry?
Hello,
It cannot find .env because I suspect you haven't created it. I had this same issue and each time I had to manually create the .env file. Perhaps there is something wrong with the create script as it creates one .env but I believe it doesn't create the root .env. Try duplicating the root .env.example and renaming to .env and then run the create-project command again.
Also with your domain question, just add another entry, don't think there is any need to override anything.
Hope this helps
I have it created. Actually I've just removed the .example from all extensions here's my tree
. ├── certs │ ├── alquimia.local-key.pem │ └── alquimia.local.pem ├── cli │ └── create-cert.sh ├── config │ ├── php.ini │ └── phpmyadmin.ini ├── docker-compose.yml ├── Dockerfile ├── .env ├── .git │ ├── branches │ ├── config │ ├── description │ ├── HEAD │ ├── hooks │ ├── index │ ├── info │ ├── logs │ ├── objects │ ├── packed-refs │ └── refs ├── .gitignore ├── nginx │ └── default.conf.conf ├── README.md ├── src │ ├── CHANGELOG.md │ ├── composer.json │ ├── composer.lock │ ├── config │ ├── .env │ ├── .github │ ├── .gitignore │ ├── LICENSE.md │ ├── phpcs.xml │ ├── README.md │ ├── vendor │ ├── web │ └── wp-cli.yml └── .travis.yml
16 directories, 26 files
@jramiresbrito what does your .env
file in the root folder look like? You need that also, not just the src/.env
@jramiresbrito you need to run both docker-compose run composer create-project
and docker-compose up
at the root of the project (not under /cli
folder for example)