Docker Compose does not allow to use local images

后端 未结 9 1961
-上瘾入骨i
-上瘾入骨i 2020-12-24 00:33

The following command fails, trying to pull image from the Docker Hub:

$ docker-compose up -d
Pulling web-server (web-server:staging)...
ERROR: repository we         


        
9条回答
  •  没有蜡笔的小新
    2020-12-24 01:00

    Version >1.23 (2019 and newer)

    Easiest way is to change image to build: and reference the Dockerfile in the relative directory, as shown below:

    version: '3.0'
    services:
      custom_1:
        build:
          context: ./my_dir
          dockerfile: Dockerfile
    

    This allows docker-compose to manage the entire build and image orchestration in a single command.

    # Rebuild all images
    docker-compose build
    # Run system
    docker-compose up
    

提交回复
热议问题