# How to upgrade Mautic 5 to 5 or 6 inside a docker container?

**URL:** <https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061>\
**Category:** Docker support\
**Created:** [July 13, 2025, 11:58am UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061 "2025-07-13T11:58:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris76](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/chris76/32/522_2.png) [@Chris76](https://forum.mautic.org/u/Chris76)\
**Post date:** [July 13, 2025, 11:58am UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/1 "2025-07-13T11:58:16Z")

</div>

**Your software**  
My Mautic version is: Not sure anymore - some 5.0 or similar  
My PHP version is: Official Mautic docker 5 image  
My Database type and version is: Same - Official Mautic docker

**Your problem**  
My problem is:  
I believe I’ve upgraded my docker container the docker way.  
My docker-compose.yaml contains (a few months old and working for a few months as well):

```auto
  mautic_web:
    image: mautic/mautic:5-apache

```

Then I’ve done (I believe):

```auto
docker compose stop
docker compose pull
docker compose up

```

Now, I should have a new Mautic version with an old DB?  
I get a 500 error message in the browser and see this one in the logs:

```auto
[2025-07-13T05:45:01.317212+00:00] mautic.ERROR: Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'c0_.deleted' in 'SELECT' (uncaught exception) at /var/www/html/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 67 while running console command `mautic:campaigns:rebuild` [stack trace] #0 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1938): Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query)) #1 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1880): Doctrine\DBAL\Connection->handleDriverException(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query)) #2 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1105): Doctrine\DBAL\Connection->convertExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDO\Exception), 'SELECT c0_.is_p...', Array, Array) #3 /var/www/html/vendor/doctrine/orm/src/Query/Exec/FinalizedSelectExecutor.php(31): Doctrine\DBAL\Connection->executeQuery('SELECT c0_.is_p...', Array, Array, NULL) #4 /var/www/html/vendor/doctrine/orm/src/Query.php(330): Doctrine\ORM\Query\Exec\FinalizedSelectExecutor->execute(Object(Mautic\CoreBundle\Doctrine\Connection\ConnectionWrapper), Array, Array) #5 /var/www/html/vendor/doctrine/orm/src/AbstractQuery.php(1151): Doctrine\ORM\Query->_doExecute() #6 /var/www/html/vendor/doctrine/orm/src/Query.php(748): Doctrine\ORM\AbstractQuery->toIterable(Array, 1) #7 /var/www/html/docroot/app/bundles/CoreBundle/Entity/CommonRepository.php(380): Doctrine\ORM\Query->toIterable(Array, 1) #8 /var/www/html/docroot/app/bundles/CampaignBundle/Entity/CampaignRepository.php(37): Mautic\CoreBundle\Entity\CommonRepository->getEntities(Array) #9 /var/www/html/docroot/app/bundles/CampaignBundle/Command/UpdateLeadCampaignsCommand.php(162): Mautic\CampaignBundle\Entity\CampaignRepository->getEntities(Array) #10 /var/www/html/vendor/symfony/console/Command/Command.php(298): Mautic\CampaignBundle\Command\UpdateLeadCampaignsCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /var/www/html/vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Component\Console\Application->doRunCommand(Object(Mautic\CampaignBundle\Command\UpdateLeadCampaignsCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 /var/www/html/vendor/symfony/console/Application.php(301): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Mautic\CampaignBundle\Command\UpdateLeadCampaignsCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 /var/www/html/bin/console(16): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #17 {main} [] {"hostname":"b872de7f00b9","pid":443}

```

Not sure, whether it is related?  
Any idea on how to solve this?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 14, 2025, 8:45am UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/2 "2025-07-14T08:45:55Z")

</div>

@Chris76 I’ve moved this to #Product Support > Docker support as that seems to be a more appropriate place for it.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [July 16, 2025, 12:59pm UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/3 "2025-07-16T12:59:13Z")

</div>

It seems the migrations weren’t executed. Please run `bin/console doctrine:migrations:migrate` inside the docker container.

---

<div class="post-metadata">

**Author:** ![Chris76](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/chris76/32/522_2.png) [@Chris76](https://forum.mautic.org/u/Chris76)\
**Post date:** [July 17, 2025, 8:49pm UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/4 "2025-07-17T20:49:27Z")

</div>

Hello @escopecz

thanks for your reply.

There are 3 containers:  
mautic\_cron-1  
mautic\_worker-1  
mautic\_web-1

So I tried in the web first:

```auto
docker exec -it bae2d0218b24 php /var/www/html/bin/console doctrine:migrations:status
docker exec -it bae2d0218b24 php /var/www/html/bin/console cache:clear

```

that seem to have worked somewhat.  
Afterwards, I was able to login and see some details - but it seems like, some CSS / cache issue remained:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/9/996901b92d5a90df6271309525e36d0c74ad3348.png)

So I checked the upgrade guide to search for help and details.

> **[How to update Mautic — Mautic Documentation 0.1 documentation](https://docs.mautic.org/en/5.x/getting_started/how_to_update_mautic.html)**

and figured, I’d try to upgrade / go through the process - now moving on to Mautic 6

```auto
docker exec -it bae2d0218b24 php /var/www/html/bin/console mautic:update:find
docker exec -it bae2d0218b24 php /var/www/html/bin/console mautic:update:apply
docker exec -it bae2d0218b24 php /var/www/html/bin/console mautic:update:apply --finish

[17-Jul-2025 20:40:29 UTC] PHP Fatal error: Type of Mautic\ApiBundle\Entity\oAuth2\Client::$randomId must not be defined (as in class FOS\OAuthServerBundle\Model\Client) in /var/www/html/docroot/app/bundles/ApiBundle/Entity/oAuth2/Client.php on line 15

Fatal error: Type of Mautic\ApiBundle\Entity\oAuth2\Client::$randomId must not be defined (as in class FOS\OAuthServerBundle\Model\Client) in /var/www/html/docroot/app/bundles/ApiBundle/Entity/oAuth2/Client.php on line 15

```

How to get out of this situation?  
The result so far is definitely worse:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/3/3f38977a3fc312beb1bb6ae4a5fde5f1dd1a4ce9.png)

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [July 18, 2025, 7:52am UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/5 "2025-07-18T07:52:36Z")

</div>

From the error message it seems like the Mautic code does not fit the installed libraries versions. Do you have `composer` available in the container? Is `composer --version` returning something?

---

<div class="post-metadata">

**Author:** ![Chris76](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/chris76/32/522_2.png) [@Chris76](https://forum.mautic.org/u/Chris76)\
**Post date:** [July 18, 2025, 9:25am UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/6 "2025-07-18T09:25:34Z")

</div>

Seems as if the official docker image doesn’t contain composer (at least on in the $PATH):

```auto
docker exec -it bae2d0218b24 composer --version
OCI runtime exec failed: exec failed: unable to start container process: exec: "composer": executable file not found in $PATH: unknown

```

Is docker the way to go, or would I better avoid docker, if it can’t be upgraded the “docker way” anyway?

However, I’ve tried to progress:

```auto
$ docker exec -it bae2d0218b24 php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ docker exec -it bae2d0218b24 php composer-setup.php
All settings correct for using Composer
Downloading...

Composer (version 2.8.10) successfully installed to: /var/www/html/docroot/composer.phar
Use it: php composer.phar

$ docker exec -it bae2d0218b24 mv composer.phar /usr/local/bin/composer
$ docker exec -it bae2d0218b24 composer --version
Composer version 2.8.10 2025-07-10 19:08:33
PHP version 8.1.32 (/usr/local/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.

$ docker exec -it bae2d0218b24 composer update
Loading composer repositories with package information

In Git.php line 592:
                                                                                                                                          
  Failed to clone https://github.com/mautic/SymfonyBridgeBundle.git, git was not found, check that it is installed and in your PATH env.  
                                                                                                                                          
  sh: 1: exec: git: not found                                                                                                             
                                                                                                                                          

```

Then I get stuck in the “slim” Linux for the container.  
That’s why I doubt the Docker approach here - either I’m doing this very wrong or the whole thing isn’t “made” for being in Docker?  
(Compare a MySQL or PHP container / version upgrade)

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [July 18, 2025, 10:46am UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/7 "2025-07-18T10:46:11Z")

</div>

You may have to get into the container and execute `composer install` there. Please do not use `composer update` as it could download untested libraries.

Although I’m not sure this is the right approach to update Docker. I’ve linked this form thread in the #docker Slack channel to get more eyes from Docker experts here. The Docker images are meant to be immutable. Once you upgrade to a new Docker image it shoudn’t require file changes. Just running the database migrations as the migrations are stored in a volume, not the docker image.

---

<div class="post-metadata">

**Author:** ![Chris76](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/chris76/32/522_2.png) [@Chris76](https://forum.mautic.org/u/Chris76)\
**Post date:** [July 18, 2025, 2:26pm UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/8 "2025-07-18T14:26:32Z")

</div>

How do you install your Mautic?

---

<div class="post-metadata">

**Author:** ![cfipilot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cfipilot/32/13694_2.png) [@cfipilot](https://forum.mautic.org/u/cfipilot)\
**Post date:** [December 18, 2025, 1:45am UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/9 "2025-12-18T01:45:51Z")

</div>

Was this fixed? I was thinking about going to mautic 6 from 5.5.

Im already using docker but it took some time to get my setup working that im afraid to break it

---

<div class="post-metadata">

**Author:** ![mybpoconsultant](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mybpoconsultant/32/6161_2.png) [@mybpoconsultant](https://forum.mautic.org/u/mybpoconsultant)\
**Post date:** [May 5, 2026, 7:15pm UTC](https://forum.mautic.org/t/how-to-upgrade-mautic-5-to-5-or-6-inside-a-docker-container/36061/10 "2026-05-05T19:15:28Z")

</div>

I am not sure if you are supposed to be using Composer inside of a Mautic Docker container, so proceed with caution, I was having a play with a broken instance, but this worked for me

\*\*⚠ First: back up your database before trying anything below and any Persistent Docker volumes to be extra safe

**Your software**  
My Mautic version before the update was Mautic 6 something then the Docker update upgraded it to V7.1.1  
My PHP version is: 8.3.30  
My Database type and version is: mysql:8.0 - pdo\_mysql -  
Ubuntu 24.04 - Hostinger VPS

\*\*

### What I did:

1. **Pulled the latest Docker image**

2. **Accessed the container terminal**

3. **Ran the following commands inside the container:**

After doing this, my Mautic instance started working again and was much smoother… The only thing I see is that annoying CSFR token error, most likely I gotta clear some cache and have a play with some settings..

UPDATE: As I suspected, I had to run this as the final step…

php bin/console cache:clear

That got rid of the CSFR Token error…

UPDATE #2 …

After I played around with Mautic, there were some other problems, but this seems to have fixed it, I will give Update #3 if not …

> cd /var/www/html && rm -rf var/cache/\* app/cache/\* && php bin/console cache:clear && php bin/console cache:warmup && php bin/console doctrine:migrations:migrate --no-interaction && php bin/console doctrine:schema:update --force && composer dump-autoload && chown -R www-data:www-data . && chmod -R 755 . && echo “DONE”

I am not sure if this is a safe way to do it though, I am curious on thoughts from the community on this one. ~ Cloud Potions

* * *
