memgraphdb

How to always pull the latest Memgraph docker image when using Docker compose?


I've seen last week that Memgraph 2.16 was released. I use the following docker-compose.yml file:

version: "3"

services:
  memgraph:
    image: memgraph/memgraph-mage:latest
    container_name: memgraph-mage
    ports:
      - "7687:7687"
      - "7444:7444"
    command: ["--log-level=TRACE"]

  lab:
    image: memgraph/lab:latest
    container_name: memgraph-lab
    ports:
      - "3000:3000"
    depends_on:
      - memgraph
    environment:
      - QUICK_CONNECT_MG_HOST=memgraph
      - QUICK_CONNECT_MG_PORT=7687

When I run it, I get the Memgraph 2.15.2, and not 2.16.

I noticed that I have a local docker image with 2.15.2 tag that is tagged as latest. I've deleted it, and now I get 2.16 when I run docker compose.

What can I add to my docker-compose.yml to always pull the latest from Docker hub? I'm looking for something that would be equivalent to docker run --pull=always.


Solution

  • You need to update your YAML file so that version is 3.4, and you need to set pull_policy: always. This way, when you run docker compose up latest tag will refere to the Docker hub version.

    version: "3.4" 
    
    services:
      memgraph:
        image: memgraph/memgraph-mage:latest
        container_name: memgraph-mage
        ports:
          - "7687:7687"
          - "7444:7444"
        command: ["--log-level=TRACE"]
        pull_policy: always
    
      lab:
        image: memgraph/lab:latest
        container_name: memgraph-lab
        ports:
          - "3000:3000"
        depends_on:
          - memgraph
        environment:
          - QUICK_CONNECT_MG_HOST=memgraph
          - QUICK_CONNECT_MG_PORT=7687
        pull_policy: always