[comment]: # ({857906ba-e1f5ce3f})
# 3 Upgrade from containers

[comment]: # ({/857906ba-e1f5ce3f})

[comment]: # ({23da9739-236aea13})
### Overview

This section describes the steps required for a successful [upgrade](/manual/installation/upgrade) to Zabbix **7.0**.x containers.

Separate sets of instructions are available for:

-   [Zabbix component image upgrade](#zabbix-component-image-upgrade)
-   [Docker Compose file upgrade](#docker-compose-file-upgrade)

::: notewarning
Before the upgrade make sure to read the relevant [**upgrade notes**](/manual/installation/upgrade)!
:::

::: noteimportant
Before starting the upgrade, verify that users have the necessary permissions to the database for upgrading purposes.
<br><br>
For upgrades from Zabbix 6.0 or older, deterministic triggers will need to be created during the upgrade.
If binary logging is enabled for MySQL/MariaDB, this requires superuser privileges or setting the variable/configuration parameter  `log_bin_trust_function_creators = 1`.
See [Database creation scripts](/manual/appendix/install/db_scripts#mysqlmariadb) for instructions how to set the variable.
<br><br>
Note that if executing from a console, the variable will only be set temporarily and will be dropped when a Docker is restarted.
In this case, keep your SQL service running, only stop `zabbix-server` service by running `docker compose down zabbix-server` and then `docker compose up -d zabbix-server`.
<br><br>
Alternatively, you can set this variable in the configuration file.
:::

Depending on the database size, the database upgrade to version 7.0 may take a long time.

[comment]: # ({/23da9739-236aea13})

[comment]: # ({70ae2ebf-27011b38})
### Zabbix component image upgrade

These instructions upgrade your Docker images used as a base for your Zabbix component containers.

The steps below use a Zabbix proxy as an example.
Replace `zabbix-proxy-sqlite3` with your component's container name.

1\. Check all containers to identify their names and current image versions:

```bash
docker ps -a

# CONTAINER ID   IMAGE                                           (...) NAMES
# 5a0c2e3d02b4   zabbix/zabbix-proxy-sqlite3:alpine-6.4-latest   (...) zabbix-proxy-sqlite3
```

2\. Pull the new image version:

```bash
docker pull zabbix/zabbix-proxy-sqlite3:alpine-7.0-latest
```

3\. Stop the Zabbix component container:

```bash
docker stop zabbix-proxy-sqlite3
```

4\. Remove the Zabbix component container:

::: noteimportant
Make sure you have noted all configuration flags and volume mounts used in the original `docker run` command before proceeding, as they will be needed to recreate the container.
:::

```bash
docker rm zabbix-proxy-sqlite3
```

5\. Start a new container using the updated image:

```bash
docker run --name zabbix-proxy-sqlite3 \
  -e ZBX_SERVER_HOST=192.0.2.0 \
  -e ZBX_PROXYMODE=0 \
  -e ZBX_HOSTNAME=zabbix-proxy-sqlite3 \
  -v zabbix-proxy-data:/var/lib/zabbix/db_data \
  --init \
  -d \
  zabbix/zabbix-proxy-sqlite3:alpine-7.0-latest
```

::: noteclassic
For more information on running Zabbix containers, see [Docker (manual deployment)](/manual/installation/containers#docker-manual-deployment).
:::

6\. Verify that the upgrade was successful by checking the container logs:

```bash
docker logs -f zabbix-proxy-sqlite3
```

[comment]: # ({/70ae2ebf-27011b38})

[comment]: # ({9b5b55d2-d707ad1d})
### Docker Compose file upgrade

These instructions upgrade the Docker Compose files used for deploying Zabbix components.
Follow these instructions if you installed Zabbix using [Docker Compose](/manual/installation/containers#docker-compose).

1\. Check all containers to identify their names and current image versions:

```bash
docker ps -a

# CONTAINER ID   IMAGE                                             (...) NAMES
# d095f486deef   zabbix/zabbix-server-mysql:alpine-6.4-latest      (...) zabbix-docker-zabbix-server-1
# 70627d833da0   zabbix/zabbix-web-nginx-mysql:alpine-6.4-latest   (...) zabbix-docker-zabbix-web-nginx-mysql-1
# aaaa664cc185   zabbix/zabbix-server-mysql:alpine-6.4-latest      (...) zabbix-docker-server-db-init-1
# 9ab3e77492ff   mysql:8.0-oracle                                  (...) zabbix-docker-mysql-server-1
```

2\. Navigate to the Zabbix Docker repository you previously cloned, pull the latest updates, and switch to the 7.0 branch:

::: noteimportant
If you have modified `.env`, `compose.yaml`, or other files in your local repository, a `git pull` may overwrite them.
Back up any local changes before running this step.
:::

```bash
cd zabbix-docker
git pull
git checkout 7.0
```

3\. Deploy Zabbix components using the updated Docker Compose file:

```bash
# With MySQL as the database:
docker compose -f ./compose.yaml up -d

# With PostgreSQL as the database:
docker compose -f ./compose_pgsql.yaml up -d
```

::: noteclassic
After all containers are recreated and started, it may take 1—3 minutes before data collection resumes.
For more information on running Zabbix containers, see [Docker Compose](/manual/installation/containers#docker-compose).
:::

4\. Verify that the upgrade was successful by checking the container logs (replace `zabbix-docker-zabbix-server-1` with the name of your component's container):

```bash
docker logs -f zabbix-docker-zabbix-server-1
```

[comment]: # ({/9b5b55d2-d707ad1d})
