Docker production ready questions

I’ve been using docker for a while now for development. using at first just docker, now transferred to docker-compose. This is working perfectly locally.
Now I am trying to get my app on my production servers running with docker swarm.
I am looking for some best practices.

Right now I have laravel application, with 5 services.

  • MySQL
  • Redis
  • Custom container with the code on it.
  • Beanstalkd
  • php7 queue:listen container

To deploy I run the command:
docker stack deploy -c docker-compose-prod.yml myapp
This works, mostly… the queue:listen container exits non-zero exit (255)
This is not my highest concern and I could fix this with a bit of effort.

Now that my application is deployed. I can reach it at the IP. But I can’t do any database connections because the database doesn’t have any tables. How can I run my php artisan migrate command, to fill the database?

Besides that, is it best practice to push the code into a new docker image every time you get a hotfix or new release?

Does anyone have some good tutorials for setting up a production ready project with laravel or similar using docker swarm to deploy?

Or is docker swarm not good enough? and should I use something else?

Thank you so much, I would appreciate any help :slight_smile:

1 Like