代码之家  ›  专栏  ›  技术社区  ›  wandermonk

无法使用docker compose生成和运行docker容器

  •  0
  • wandermonk  · 技术社区  · 8 年前

    我有一个 docker-compose.yml 用于构建和运行nodejs web应用程序以及MongoDB实例的文件。

    当我在运行 docker-compose up --build 命令失败,出现以下错误。

    Digest: sha256:3a09cd85fb4e76f1d5832f9ea1d4e7481f76e807389b7d8ea6ac4d4ba96f83e5
    Status: Downloaded newer image for mongo:latest
    Starting db
    Recreating compose_web_1
    
    ERROR: for web  no such image: sha256:1fb4f8e17b47e1fafd29d0f425bf86b934130847ff4b99b055c6757ccaad5bc4: No such image: sha256:1fb4f8e17b47e1fafd29d0f425bf86b934130847ff4b99b055c6757ccaad5bc4
    ERROR: Encountered errors while bringing up the project.
    

    尝试的步骤:

    • 清理了所有的图像。
    • 清洗了所有的容器。
    • 起初,我在跑步 docker-compose up 但错误发生后,我正在跑步 docker组装--组装

    这一错误的潜在原因可能是什么。

    docker撰写。yml

       version: '2'
        services:
          db:
            image: mongo:latest
            container_name: db
            networks:
              - todonet
          web:
            build: ../.
            networks:
              - todonet
            ports:
             - "3000"
        networks:
          todonet:
            driver: bridge
    

    目录结构:

    ├── app
    │   ├── node_modules
    │   │   ├── accepts
    │   │   ├── async
    │   │   │   ├── dist
    │   │   │   └── lib
    │   │   ├── basic-auth
    │   │   ├── bluebird
    │   │   │   └── js
    │   │   │       ├── browser
    │   │   │       └── main
    │   │   ├── body-parser
    │   │   │   └── lib
    │   │   │       └── types
    │   │   ├── bson
    │   │   │   ├── alternate_parsers
    │   │   │   ├── browser_build
    │   │   │   ├── lib
    │   │   │   │   └── bson
    │   │   │   │       └── parser
    │   │   │   └── tools
    │   │   ├── bytes
    │   │   ├── cookie
    │   │   ├── cookie-parser
    │   │   │   └── lib
    │   │   ├── cookie-signature
    │   │   ├── core-util-is
    │   │   │   └── lib
    │   │   ├── crc
    │   │   │   └── lib
    │   │   ├── debug
    │   │   ├── depd
    │   │   │   └── lib
    │   │   │       └── compat
    │   │   ├── destroy
    │   │   ├── ee-first
    │   │   ├── ejs
    │   │   │   ├── examples
    │   │   │   ├── lib
    │   │   │   ├── support
    │   │   │   └── test
    │   │   │       └── fixtures
    │   │   │           └── includes
    │   │   │               └── menu
    │   │   ├── ejs-locals
    │   │   │   ├── example
    │   │   │   │   └── views
    │   │   │   ├── node_modules
    │   │   │   │   └── ejs
    │   │   │   │       ├── examples
    │   │   │   │       ├── lib
    │   │   │   │       ├── support
    │   │   │   │       └── test
    │   │   │   │           └── fixtures
    │   │   │   │               └── includes
    │   │   │   │                   └── menu
    │   │   │   └── test
    │   │   │       ├── fixtures
    │   │   │       │   ├── blog
    │   │   │       │   │   └── post
    │   │   │       │   ├── path
    │   │   │       │   │   └── to
    │   │   │       │   ├── subfolder
    │   │   │       │   └── thing
    │   │   │       └── support
    │   │   ├── errorhandler
    │   │   │   └── public
    │   │   ├── es6-promise
    │   │   │   ├── dist
    │   │   │   └── lib
    │   │   │       └── es6-promise
    │   │   │           └── promise
    │   │   ├── escape-html
    │   │   ├── etag
    │   │   ├── express
    │   │   │   ├── lib
    │   │   │   │   ├── middleware
    │   │   │   │   └── router
    │   │   │   └── node_modules
    │   │   │       └── depd
    │   │   │           └── lib
    │   │   │               └── compat
    │   │   ├── finalhandler
    │   │   ├── forwarded
    │   │   ├── fresh
    │   │   ├── hooks-fixed
    │   │   ├── iconv-lite
    │   │   │   ├── encodings
    │   │   │   │   └── tables
    │   │   │   └── lib
    │   │   ├── inherits
    │   │   ├── ipaddr.js
    │   │   │   ├── lib
    │   │   │   ├── src
    │   │   │   └── test
    │   │   ├── isarray
    │   │   │   └── build
    │   │   ├── kareem
    │   │   │   └── test
    │   │   ├── media-typer
    │   │   ├── merge-descriptors
    │   │   ├── method-override
    │   │   ├── methods
    │   │   │   └── test
    │   │   ├── mime
    │   │   │   └── types
    │   │   ├── mime-db
    │   │   ├── mime-types
    │   │   ├── mongodb
    │   │   │   └── lib
    │   │   │       ├── bulk
    │   │   │       ├── gridfs
    │   │   │       └── gridfs-stream
    │   │   ├── mongodb-core
    │   │   │   └── lib
    │   │   │       ├── auth
    │   │   │       ├── connection
    │   │   │       ├── tools
    │   │   │       ├── topologies
    │   │   │       │   └── strategies
    │   │   │       └── wireprotocol
    │   │   ├── mongoose
    │   │   │   ├── examples
    │   │   │   │   ├── aggregate
    │   │   │   │   ├── express
    │   │   │   │   │   └── connection-sharing
    │   │   │   │   ├── geospatial
    │   │   │   │   ├── globalschemas
    │   │   │   │   ├── lean
    │   │   │   │   ├── mapreduce
    │   │   │   │   ├── population
    │   │   │   │   ├── promises
    │   │   │   │   ├── querybuilder
    │   │   │   │   ├── replicasets
    │   │   │   │   ├── schema
    │   │   │   │   │   └── storing-schemas-as-json
    │   │   │   │   └── statics
    │   │   │   ├── lib
    │   │   │   │   ├── drivers
    │   │   │   │   │   ├── browser
    │   │   │   │   │   └── node-mongodb-native
    │   │   │   │   ├── error
    │   │   │   │   ├── schema
    │   │   │   │   │   └── operators
    │   │   │   │   ├── services
    │   │   │   │   └── types
    │   │   │   └── node_modules
    │   │   │       └── ms
    │   │   ├── morgan
    │   │   │   └── node_modules
    │   │   │       └── depd
    │   │   │           └── lib
    │   │   │               └── compat
    │   │   ├── mpath
    │   │   │   ├── lib
    │   │   │   └── test
    │   │   ├── mpromise
    │   │   │   ├── lib
    │   │   │   └── test
    │   │   ├── mquery
    │   │   │   ├── lib
    │   │   │   │   └── collection
    │   │   │   ├── node_modules
    │   │   │   │   ├── debug
    │   │   │   │   ├── ms
    │   │   │   │   └── sliced
    │   │   │   │       ├── lib
    │   │   │   │       └── test
    │   │   │   └── test
    │   │   │       └── collection
    │   │   ├── ms
    │   │   ├── muri
    │   │   │   ├── lib
    │   │   │   └── test
    │   │   ├── negotiator
    │   │   │   └── lib
    │   │   ├── on-finished
    │   │   ├── parseurl
    │   │   ├── path-to-regexp
    │   │   ├── proxy-addr
    │   │   ├── qs
    │   │   │   ├── lib
    │   │   │   └── test
    │   │   ├── range-parser
    │   │   ├── raw-body
    │   │   ├── readable-stream
    │   │   │   └── lib
    │   │   ├── regexp-clone
    │   │   │   └── test
    │   │   ├── require_optional
    │   │   │   └── test
    │   │   ├── resolve-from
    │   │   ├── semver
    │   │   │   ├── bin
    │   │   │   └── test
    │   │   ├── send
    │   │   │   └── node_modules
    │   │   │       └── depd
    │   │   │           └── lib
    │   │   │               └── compat
    │   │   ├── serve-favicon
    │   │   ├── serve-static
    │   │   ├── sliced
    │   │   ├── string_decoder
    │   │   ├── type-is
    │   │   ├── utils-merge
    │   │   └── vary
    │   ├── public
    │   │   ├── images
    │   │   ├── javascripts
    │   │   └── stylesheets
    │   ├── routes
    │   └── views
    ├── compose
    └── kubernetes
    

    Dockerfile:

    FROM node:slim
    LABEL maintainer = "phanikumaryadavilli@gmail.com"
    RUN mkdir -p /usr/src/app
    WORKDIR /usr/src/app
    COPY ./app/ ./
    RUN npm install
    CMD ["node", "app.js"]
    
    0 回复  |  直到 8 年前
    推荐文章