I've been working on upgrading my local environment from 2.2.10 to 2.3.4, but can't figure out how to install the extra PHP modules for the new version (ie: sodium) using Docker. I was previously using PHP 7.1, but just rebuilt my containers with 7.3. They're up and running with no problem, but how do I go about adding the modules? I tried running sudo pecl install -f libsodium which I thought would work, but because sodium wasn't added to the php.ini file it wasn't able to pick it up. I haven't been able to even find the .ini file inside the container, and am really at a loss here. The next thing I tried was adding it into the PHP Extensions line in docker-compose.yml, but this seems to break the ability to even run bin/magento from inside the container. enter image description here

Fyi I'm new to magento and docker, so I might be missing something obvious here. Thanks in advance for any help

1 Answer 1


This is a bit hard to explain if you are new to docker

But essentially you need to add these components when you build the docker image


To build that docker image and push it to docker hub would do something like this

cd php/src/7.3-fpm

docker login

docker build -t domw/magento2-php:7.3-fpm ./

docker push domw/magento2-php:7.3-fpm

Then to use it in project docker compose


    hostname: fpm.magento2.docker
    image: domw/magento2-php:7.3-fpm
    restart: 'always'
      - 9000
      - db
      - ./magento:/var/www/magento
      - ./global.env
  • Hey thanks so much for the informative response. This might be a dumb question, but since the image I'm pulling is from magento, how can I edit the original Dockerfile to include the modules I need? Do I need to clone the full magento docker to my github, alter the Dockerfile, then pull from this repo? Commented Jun 8, 2020 at 14:27
  • Can I take a look at docker image? Commented Jun 8, 2020 at 18:47
  • Here is the docker-compose.yml: pastebin.com/mXzX30DW, and I'm also using a docker-compose.override.yml file: pastebin.com/8giPFvtK. I don't have access to the Dockerfile itself, which I think may be one of the problems? Commented Jun 8, 2020 at 20:04
  • First time I'm seen an official(ish) docker compose file. Where did you get that from or did you put that together yourself? I put together my own stack github.com/DominicWatts/docker-magento2 but mine is a fork of the meanbee solution. I just got mine working how I wanted it and added some quick steps and bits and pieces. Performance was a big thing for me but I started this on windows. Now using linux (debian). But it's not the fastest and always having to look at permissions. But good enough for dev. Any time need something I add to docker file and rebuild and push to dockerhub Commented Jun 8, 2020 at 21:33
  • Well you've blown my mind. All the source files are here github.com/magento/magento-cloud-docker/tree/develop/images/php Commented Jun 8, 2020 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.