简体   繁体   English

我的docker-compose.yml有什么问题?

[英]What is wrong with my docker-compose.yml?

Seems like it is a error in my yml file. 似乎这是我的yml文件中的错误。 I read a lot of articles here but found nothing. 我在这里阅读了很多文章,但没有发现任何内容。 I still cannot get it to work. 我仍然无法正常工作。 I purposely removed some unnecessary parts of my code, so here it is: 我故意删除了代码中一些不必要的部分,因此在这里是:

version: '3.3'
services:
  shop:
    image: azamatibraimov/repository:shop
    restart: always
    ports:
      - 8080:8080
    expose:
      - '8080'
    depends_on:
      - db
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: 'mydb'
      MYSQL_ROOT_PASSWORD: '123'
    ports:
      - '3306:3306'

So,When I do this: 所以,当我这样做时:

docker login && docker-compose up

I have this output: 我有这个输出:

ERROR: manifest for azamatibraimov/repository:shop not found

What or where is the shop:latest docker image? shop:latest docker image是什么? Is this something that you are trying to build locally? 这是您要在本地构建的东西吗? If so, add the following to your shop service: 如果是这样,请将以下内容添加到您的shop服务中:

shop:
  build:
    context: .
  image: shop:latest
  …

As context, put the folder where the Dockerfile for the shop is located. 作为上下文,将商店的Dockerfile放置在该文件夹中。

I'm assuming that you pushed the image to a docker hub. 我假设您已将映像推送到docker hub。 azamatibraimov/repository:shop Is this the right docker image name? azamatibraimov/repository:shop这是正确的azamatibraimov/repository:shop映像名称吗?

To pull the image, the correct syntax is: username/repositoryname:tagname 要提取图像,正确的语法是: username/repositoryname:tagname

Default tag name is "latest". 默认标签名称为“最新”。 So, if you left it blank when you pushed image, this could be your correct image name: azamatibraimov/repository:latest 因此,如果在推送图像时将其留为空白,则可能是正确的图像名称: azamatibraimov/repository:latest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM