Zend certified PHP/Magento developer

Using docker as development environment

I’m trying to have a docker container, install some development-related tools in it, and use it to develop my software (using vscode’s remote development features). I’ll later be able to do docker start my-flutter-dev-container and then docker attach to go back to this.

In my case, I use Fedora, but Flutter can only be installed under Debian based distributions. So I’m using the ubuntu docker image, mapping a volume from my host to the container, so I can develop in the container.
Another motivation is to do my nodejs development in a container, so if I accidentally install a malicious library it does not have access to my whole system.

Here is the problem:

  • If I run my container normally, files create will be owned by root, so I’ll have problems managing them in the host. Need to constantly change owenrship.
  • If I run my container under a non-root user, apt install does not work in the container. I cannot do su - as I don’t have a password, and sudo is not installed as well.

The command I use to run under non-root is:

docker run --name ubuntu-dev -u 1000 -v /home/ali/work:/home/ali/work:z -it ubuntu:latest