-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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-compose.yml and custom script after entrypoint (before command) #205
Comments
Finally! Found it. Looks like it works like this: (Notice that your command must be named "apache2-something", with apache2 in front, otherwise the entrypoint in this docker image does not do what it's supposed to do. docker-compose.yml ---
version: '2.1'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
image: wordpress:latest
volumes:
- "./wp-init.sh:/usr/local/bin/apache2-custom.sh"
depends_on:
db:
condition: service_started
ports:
- 80:80
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
command:
- apache2-custom.sh
volumes:
db_data: then wp-init.sh
|
Why the command file should be named with prefix "apache2"? I'm trying to do the same thing with toke/mosquitto do you know the prefix that I should use? Do you know if I could be able to run a command line? Thank you. |
Thanks, you saved my day ! |
Same question as @rsegecin |
@rsegecin @hustshawn I think it is because this line |
I suppose this image is not meant to be used like this (even though it works as I mentioned) instead one should create own Docker image that 'inherits' from the WordPress image with own init stuff. With docker-compose.yml the image is always recreated, but for simple use cases there should be a more obvious and documented way to add a script before all that init. |
Thanks for @Ciantic , it's working for me. 💯 |
I prefer using a dokerfile this way I avoid creating the image each time I run docker-compose dockerfile
docker-entrypoint.sh
|
Hi @benaich |
@triusis92 see #474 (comment) (and #74 + #249) for why mounted files are not automatically chowned. You need to either run the container as the owner of the files with |
Hi @yosifkit
Dockerfile called during build
docker-entrypoint.sh
The outcome of all this is that all the files and directories mounted inside the container have the correct permission "www-data:www-data" except for wp-content which is "root:root". Even all the content inside wp-content has "www-data:www-data" privileges
If I change the ownership of wp-content folder manually only to "www-data www-data" everything works perfectly. I'm not a proficient Docker user and I've tried adjusting the script, docker-compose and Dockerfile in many ways, the result is always the same, wp-content always ends up under "root:root" privileges UPDATE: |
Thanks for this. I was trying to load a .dump file into neo4j. This was the only way I could do it. |
I have fairly simple need, and have been struggling with this many hours now. I want to run some script after entrypoint, and before command. I've tried running it as a command but no luck.
docker-compose.yml
wp-init.sh
If I start this, I only get forbidden from browser. It starts up normally if I comment entrypoint and command though.
I've also tried creating a dockerfile, like in the issue #130, but it didn't work with docker compose either.
The text was updated successfully, but these errors were encountered: