Reputation: 2153
I'm using Laravel with docker. Inside my dockerfile I have this command:
RUN php artisan config:cache
This is useful for production since it cache the configuration. When I'm developing I need to be able to change the configuration quite often, so every time I run the image I need to execute
RUN php artisan config:clear
is there a way to run the docker image with a given command? i.e.:
docker run my_image "php artisan config:clear"
(If you're wondering, I'm doing docker run
instead of docker start
quite often since I'm building the image quite often.)
I'd like to avoid using CMD inside dockerfile since it's not really needed.
Thanks
Upvotes: 0
Views: 278
Reputation: 5452
If you want to run the command inside a currently running container you can use the exec command:
$ docker exec yourapp_web_1 php artisan config:clear
Upvotes: 1