0

We have a large PHP application that's quite challenging to initiate on a development machine. This situation has led us to seek a better solution, which we believe may be Docker development environments. Our goal is to ensure a smooth setup on development machines, as we currently spend approximately 5-7 hours setting up the project for every new developer.

Now, we are facing another issue. While developing, we run the PHP project in another Docker container. After some research, I found out about the Docker official image and numerous reasons why not to use it. However, these reasons primarily pertain to CI, not development environments.

Unfortunately, I couldn't find more information on this issue, or definitive advice on whether it's a good or a bad idea, and for what reasons. Therefore, I am kindly asking the community for guidance. Should I proceed with this? If so, are there any best practices? Or, are there better alternatives for Docker-in-Docker development?

I acknowledge that these questions are somewhat general, but I couldn't find any specific information on this topic. I want to ensure that I know the best practices before I start working on this project.

MrJami
  • 685
  • 4
  • 16
  • D-in-D is generally only needed when you want to build a docker image from with a docker image, which is typically something that is only done in a CI environment. There's no reason you can't run your dev env in a docker container, but still build any images outside of it. – SiHa Jul 20 '23 at 09:53
  • 1
    I do not understand why would you want DIND for development environment. Just develop on the host and run the project in a container. (The better alternative is to have ovirt farm and give every developer a private virtual machine, so he can install/mess/destroy anythink the particular developer likes.) `While developing, we run the PHP project in another Docker container` So do exactly that. What problem does DIND solve? `we currently spend approximately 5-7 hours` You did not explain what "setting up" exactly means. You can prepare a script, or ansible, that installs stuff. – KamilCuk Jul 20 '23 at 09:58
  • @SiHa yes, that was also our initial thought on having the application run also on the same docker container, which the dev environment uses. However because of management reasons, that time should not be spent on implementing that. But remain the project the way it is and only add the dev environment to it – MrJami Jul 20 '23 at 09:58
  • @KamilCuk because of the installation of the dependencies and running the project varies almost every time. Unknown reasons, it just doesn't work. We tried it using Windows, Ubuntu, Arch and MacOS. None of them showed any kind of consistency. There is already a shell script to install the dependencies, but as said, it still has a lot of inconsistency – MrJami Jul 20 '23 at 10:00
  • So have docker with all dependencies installed and _run_ your application in docker. Then you _develop_ on the host with `vim` or `nano` or `vscode` or anything developer desires. I still do not understand where does DIND come in. Have you ever used docker? Use a docker image with dependencies to _run_ your stuff, both production and tests and for development. Develop (edit files) on the host. – KamilCuk Jul 20 '23 at 10:02
  • @KamilCuk in the last 2 weeks, we have set up the project on 6 machines. Obviously the project dependencies are installed in the docker. However php, docker and other tools are installed on the host machine. These installations are almost never consistent for unknown reasons. Therefore we got the idea of using a docker dev environment. – MrJami Jul 20 '23 at 10:09
  • If the install is inconsistent, then you need to spend time to understand *why* it's inconsistent, and fix that. If this is something you are doing regularly, then investing some time in building an Ansible playbook to do it would be time well spent. If management don't understand that, then you have bad / stupid management. – SiHa Jul 20 '23 at 11:31

0 Answers0