【问题标题】:deploying docker container to heroku将 docker 容器部署到 heroku
【发布时间】:2018-02-05 00:27:14
【问题描述】:

我在本地使用 docker composer 构建了一个 Web 应用程序。 Docker 作曲家有多个服务,这些服务又具有各自的 dockerfile,如下所示:

version: '2'
services:

  # The Application
  app:
    build:
      context: ./
      dockerfile: app.dockerfile
    working_dir: /var/www
    volumes:
      - ./:/var/www
    environment:
      - "DB_PORT=3306"
      - "DB_HOST=database"

  # The Web Server
  web:
    build:
      context: ./
      dockerfile: web.dockerfile
    working_dir: /var/www
    volumes_from:
      - app
    ports:
      - 9002:80

  # The Database
  database:
    image: mysql:5.6
    volumes:
      - dbdata:/var/lib/mysql
    environment:
      - "MYSQL_ROOT_PASSWORD=****"
      - "MYSQL_DATABASE=****"
      - "MYSQL_USER=***"
    ports:
        - "33061:3306"

  #Cache
  memcached:
    image: memcached
    ports:
        - "11211:11211"
    mem_limit: 1g
    command: memcached -m 1024m

volumes:
  dbdata:

如何将我的应用部署到 heroku ?可以使用 docker compose file 来完成吗?或者我需要建立一个图像。 我是 heroku 的新手。请帮忙。

更新:以下是我的 docker images 命令的输出:

REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
<none>               <none>              dbdc39e8d1ae        36 hours ago        415MB
<none>               <none>              6e6ebf3dc133        36 hours ago        559MB
simplesms_app        latest              d43e46560ed8        46 hours ago        761MB
simplesms_web        latest              d1923872bf33        2 days ago          182MB
<none>               <none>              715ac76296bf        2 days ago          756MB
php                  7-apache            a47f065418d5        3 weeks ago         391MB
php                  7.0-apache          a47f065418d5        3 weeks ago         391MB
runwaytest_web       latest              a47f065418d5        3 weeks ago         391MB
php                  7.0-fpm             62e3017b4758        3 weeks ago         380MB
nginx                latest              b8efb18f159b        4 weeks ago         107MB
mysql                5.6                 cdfa8cc50c33        4 weeks ago         298MB
mysql                5.7                 c73c7527c03a        4 weeks ago         412MB
mysql                latest              c73c7527c03a        4 weeks ago         412MB
memcached            latest              0b0366c7c206        4 weeks ago         58.6MB
hello-world          latest              1815c82652c0        2 months ago        1.84kB
nginx                1.10                0346349a1a64        5 months ago        182MB
startx/sv-memcache   latest              706858567fa8        10 months ago       253MB
php                  7.0.5-fpm           e6673411c12c        16 months ago       501MB
php                  7.0.4-fpm           81d7a2fdc6dc        17 months ago       494MB

【问题讨论】:

  • 你读过这篇文章吗? devcenter.heroku.com/articles/…
  • 是的,我确实阅读了那篇文章并按照提到的步骤操作。但是在执行 heroku container:push web 时,它会显示 No images to push。我在这里一无所知。现在如何进行?
  • 将docker images 的输出添加到您的问题中
  • 现在更新了@TarunLalwani
  • 如您所见,没有网络图像。这是因为您使用docker-compose 构建。试试heroku container:push simplesms_web

标签: php docker heroku docker-compose dockerfile


【解决方案1】:

您的 web docker 文件应命名为 dockerfile.web

然后你可以运行heroku container:push --recursive --app [YOUR_APP]

或者更具体地说是heroku container:push web --recursive --app [YOUR_APP]

More info on the subject

【讨论】:

    猜你喜欢
    • 2022-06-22
    • 2020-09-09
    • 2018-08-12
    • 2015-06-20
    • 2020-12-04
    • 2021-06-24
    • 1970-01-01
    • 2022-01-23
    相关资源
    最近更新 更多