尝试运行docker-compose.yml文件时接收拉取访问被拒绝错误

时间:2017-11-03 20:47:30

标签: docker rabbitmq docker-compose dockerfile

使用node.js和docker构建基于微服务的应用程序。我创建了docker-compose.yml文件,但是当我尝试执行命令" docker-compose up -d"时,我不断收到以下错误消息:"错误:拉取访问被拒绝对于rabbbitmq,存储库不存在或者可能需要登录器登录'"。以下是我的docker-compose.yml文件示例:

version: '2'
services:
  myservice1:
    container_name: “myapp_myservice1”
    build:
      context: ../../MyService1
      dockerfile: dev.Dockerfile
    command: npm start
    volumes:
      - ../../MyService1:/usr/src/app/
    ports:
      - "3000:3000"
    depends_on:
      - mongo
      - rabbitmq
      - nginx
  myservice2:
    container_name: “myapp_myservice2”
    build:
      context: ../../MyService2
      dockerfile: dev.Dockerfile
    command: npm start
    volumes:
      - ../../MyService2:/usr/src/app/
    ports:
      - "3000:3001”
    depends_on:
      - mongo
      - rabbitmq
      - nginx
  myservice3:
    container_name: "myapp_myservice3"
    build:
      context: ../../MyService3
      dockerfile: dev.Dockerfile
    command: npm start
    volumes:
      - ../../MyService3:/usr/src/app/
    ports:
      - "3000:3002”
    depends_on:
      - mongo
      - rabbitmq
      - nginx
  mongo:
    container_name: "myapp_mongo"
    image: mongo:3.5.13
    environment:
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/dev/null
      - MONGO_INITDB_ROOT_USERNAME=*******
      - MONGO_INITDB_ROOT_PASSWORD==*******
    volumes:
      - /data/db:/data/db
    ports:
        - 27017:27017
    command: mongod --smallfiles --logpath=/dev/null # --quiet
  nginx:
    container_name: "myapp_nginx"
    image: nginx:1.13.6
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - ./nginx/conf:/etc/nginx/conf.d
    command: /bin/bash -c "envsubst < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
  rabbitmq:
    container_name: "myapp_rabbitmq"
    image: rabbbitmq:latest
    environment:
      - RABBITMQ_ERLANG_COOKIE='secret_cookie'
    hostname: fourthreefortymq
    ports:
      - "15672:15672"
      - "5672:5672"
    tty: true
    volumes:
      - ./rabbitmq/lib:/var/lib/rabbitmq
      - ./rabbitmq/log:/var/log/rabbitmq
      - ./rabbitmq/conf:/etc/rabbitmq/

以下是我的dev.Dockerfile示例:

FROM节点:最新(我注释掉了这个文件的其余部分)

它首先尝试运行rabbitmq,然后失败并显示错误消息。我甚至尝试为docker hub和登录创建一个新帐户,然后运行该命令,但我仍然收到相同的错误消息。另外,我运行了命令&#34; docker inspect rabbitmq&#34;从终端屏幕上我收到了json arry的回复。我认为这意味着它存在并且可以访问。有人可以查看下面的代码,让我知道我错过了什么?

1 个答案:

答案 0 :(得分:5)

您在rabbitmq图片名称中有一个额外的'b',它应该是rabbitmq:latest而不是rabbbitmq:latest