Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to using mongodb docker

//default username: mongoadmin
//default password: mongoadmin
mongodb:
    restart: always
    container_name: app-mongodb
    build:
      context: ./docker/images/mongodb
      dockerfile: Dockerfile
    ports:
      - "27017:27017"
    volumes:
      - ./docker/images/mongodb/data/db:/data/db
      - ./docker/images/mongodb/data/configdb:/data/configdb
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME:-mongoadmin}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD:-mongoadmin}
    networks:
      default:
        ipv4_address: 172.20.0.60

//If you want to use mongo-express
  mongo-express:
    restart: always
    container_name: app-mongo-express
    build:
      context: ./docker/images/mongo-express
      dockerfile: Dockerfile
    ports:
      - "8081:8081"
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_INITDB_ROOT_USERNAME:-mongoadmin}
      ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_INITDB_ROOT_PASSWORD:-mongoadmin}
      ME_CONFIG_MONGODB_SERVER: mongodb
    networks:
      default:
        ipv4_address: 172.20.0.70
 
PREVIOUS NEXT
Tagged: #mongodb #docker
ADD COMMENT
Topic
Name
5+3 =