Home > Software design >  I run this comman in terminal: docker-compose up dev-db -d & it gives the following error: services.
I run this comman in terminal: docker-compose up dev-db -d & it gives the following error: services.

Time:09-18

Here is docker-compose.yml file:

version: '3.8'
services:
  dev-db:
    image: postgres:13
    ports:
      - 5434:5432
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 123
      POSTGRES_DB: nest
    networks:
      - freecodecamp
  networks:
    freecodecamp

CodePudding user response:

The last networks definition needs to be pulled out a level, so it lines up with services, like this

version: '3.8'
services:
  dev-db:
    image: postgres:13
    ports:
      - 5434:5432
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 123
      POSTGRES_DB: nest
    networks:
      - freecodecamp
networks:
  freecodecamp:

Like Turing85 says, it also needs a colon after the network name.

  • Related