# Docker-compose mongodb error

**URL:** <https://community.okteto.com/t/docker-compose-mongodb-error/685>\
**Category:** Okteto Self-Hosted\
**Created:** [March 3, 2023, 10:21am UTC](https://community.okteto.com/t/docker-compose-mongodb-error/685 "2023-03-03T10:21:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iomilovanderpas](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/iomilovanderpas/32/321_2.png) [@iomilovanderpas](https://community.okteto.com/u/iomilovanderpas)\
**Post date:** [March 3, 2023, 10:21am UTC](https://community.okteto.com/t/docker-compose-mongodb-error/685/1 "2023-03-03T10:21:54Z")

</div>

Hey guys,

When I try to build a preview environment for my microservices I get this error:  
`x Error building service 'mongodb': error building image 'registry.cloud.okteto.net/pr-1-iomilovanderpas/flex-app-portal-backend-mongodb:okteto': build failed: failed to solve: content digest sha256:b65bcf19d1445822c0d6f15ea82c9ed82ac1d903cfd6c1284ba7b2409a092845: not found`.

This is my docker-compose.yml:

```auto
version: '3.8'

services:
  mongodb:    
    image: mongo   
    networks:
    - services-network
    environment: 
        MONGO_INITDB_ROOT_USERNAME: root      
        MONGO_INITDB_ROOT_PASSWORD: root      
        MONGO_INITDB_DATABASE: devops_mongo    
    expose:      
    - 27017    
    restart: always    
    volumes:      
    - ./data:/data/db
  mysqldb:
    image: 'mysql/mysql-server:8.0'
    ports:
    - '3307:3306'
    environment:
        MYSQL_ROOT_PASSWORD: 'root'
        MYSQL_ROOT_HOST: '${DB_HOST}'
        MYSQL_DATABASE: '${DB_NAME}'
        MYSQL_USER: '${DB_USERNAME}'
        MYSQL_PASSWORD: '${DB_PASSWORD}'
        MYSQL_ALLOW_EMPTY_PASSWORD: 1
    volumes: 
    - 'sail-mysql:/var/lib/mysql'
    healthcheck:
        test: ['CMD', "mysqladmin", "ping", "-p${DB_PASSWORD}"]
        retries: 3
        timeout: 5s
    networks:
    - services-network
  rabbitmq:
    image: rabbitmq:management
    container_name: rabbitmq
    hostname: "rabbitmq"
    healthcheck:
      test: rabbitmq-diagnostics -q ping
      interval: 30s
      timeout: 30s
      retries: 3
    networks:
      - services-network
    ports:
      - "15672:15672"
      - "5672:5672"
    environment:
      RABBITMQ_DEFAULT_USER: "admin"
      RABBITMQ_DEFAULT_PASS: "password"

  reservation_service:
    image: flex/reservation-service
    container_name: reservation-service
    hostname: reservation_service
    restart: on-failure
    networks:
      - services-network
    depends_on:
      rabbitmq:
        condition: service_healthy
      mysqldb:
        condition: service_healthy
    ports:
      - "5001:80"
    build:
      context: .
      dockerfile: Reservation.Microservice/Dockerfile
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
  auth_service:
    image: flex/auth-service
    container_name: auth-service
    hostname: auth_service
    restart: on-failure
    networks:
      - services-network
    depends_on:
      rabbitmq:
        condition: service_healthy
    ports:
      - "5002:80"
    build:
      context: .
      dockerfile: Auth.Microservice/Dockerfile
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ENCRYPTION_KEY=${ENCRYPTION_KEY}
      - CLIENT_SECRET=${CLIENT_SECRET}
  api_gateway:
    image: flex/api-gateway
    container_name: api-gateway
    hostname: api_gateway
    restart: on-failure
    networks:
      - services-network
    links: 
      - reservation_service
      - auth_service
    depends_on:
      - reservation_service
      - auth_service
    ports:
      - "5000:80"
    build:
      context: .
      dockerfile: Gateway.API/Dockerfile
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
        
networks:
  services-network:
volumes:
    sail-mysql:
        driver: local

```

On my local computer the docker-compose.yml builds and runs fine. Do you guys know what I should change in my docker-compose.yml to make it work in okteto? Thank you already.

---

<div class="post-metadata">

**Author:** ![AgustinRamiroDiaz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/agustinramirodiaz/32/34_2.png) [@AgustinRamiroDiaz](https://community.okteto.com/u/AgustinRamiroDiaz)\
**Post date:** [April 4, 2023, 2:33pm UTC](https://community.okteto.com/t/docker-compose-mongodb-error/685/2 "2023-04-04T14:33:54Z")

</div>

Hi @iomilovanderpas ! Sorry for the late response. Does the issue still persist?

---

<div class="post-metadata">

**Author:** ![iomilovanderpas](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/iomilovanderpas/32/321_2.png) [@iomilovanderpas](https://community.okteto.com/u/iomilovanderpas)\
**Post date:** [April 6, 2023, 11:59am UTC](https://community.okteto.com/t/docker-compose-mongodb-error/685/3 "2023-04-06T11:59:53Z")

</div>

Hi @AgustinRamiroDiaz, yes the problem has been solved. It was a long time ago, but this is my implementation right now.

```auto
mongodb:    
    image: mongo:latest
    networks:
    - services-network
    ports:
      - 27017:27017    
    restart: always    
    volumes:      
    - mongodb_data_container:/data/db

```
