Giter VIP home page Giter VIP logo

heroku-container-registry's Introduction

Heroku Container Registry CLI plugin

Heroku CLI plugin to release apps to Heroku that are built on local containers.

Installation

$ heroku plugins:install @heroku-cli/plugin-container-registry

Use

In a directory with a Dockerfile:

$ heroku container:login
$ heroku create
$ heroku container:push
$ heroku container:release web
$ heroku container:pull web
$ heroku open

heroku-container-registry's People

Contributors

alindeman avatar brettgoulder avatar denwwer avatar friism avatar hunterloftis avatar jbyrum avatar jdx avatar jkutner avatar karatecowboy avatar kennethreitz avatar mrmicahcooper avatar ojacobson avatar rasphilco avatar rgrove avatar srid avatar svc-scm avatar tkawachi avatar tt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-container-registry's Issues

Add a `heroku container:run` command

We're frequently seeing users report that an image doesn't run on Heroku even if it does locally. The common disparity is relying on root access (often incidentally) which we for security reasons don't allow.

By implementing a wrapper command, we make it easier to discover this issue and test how the image will behave in our environment.

State changed from starting to crashed

Since the container:release process was introduced, I have been unable to find a way to get my docker containers (which previously deployed without a problem) to work. No matter what I try, after the push and release process completes without a problem on the command line, I always only get the following error message in the dashboard:

State changed from starting to crashed

I have tried to push multiple different apps (all in docker containers) and in each case, the docker containers startup (and run) without errors on my machine. And, prior to the new system being introduced, I did not experience any problem deploying the same apps to heroku. So, at this point, I'm pretty sure the problem lies with either:

(a) something either missing or extra in my Dockerfile that is not documented
(b) the heroku backend

Something to note as well with the documentation.

  1. Running heroku container:push does not work unless you specify both the app you intend to push as well as a process type. eg. heroku container:push web --app myapp
  2. Running heroku container:release web does not work unless you specify the app you intend to release. eg. heroku container:release web --app myapp

If this is related to the aforementioned problem, then it may lie with the heroku-cli since it will not allow me to follow the exact directions in the README.md of this repo, at least not on my system.

Heroku Info:

  $ heroku --version
  heroku/7.0.85 linux-x64 node-v8.9.1

Dockerfile:

FROM alpine:edge

MAINTAINER <[email protected]>

# Update Alpine environment
RUN echo '@edge http://nl.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
RUN echo '@community http://nl.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories
RUN echo '@testing http://nl.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
RUN apk update
RUN apk upgrade
RUN apk add ca-certificates

# Install Python & Pip
RUN apk add curl
RUN apk add python3
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3

# Install C Compiler Dependencies
RUN apk add gcc
RUN apk add g++
RUN apk add python3-dev
RUN apk add postgresql-dev
RUN apk add libffi-dev

# Install Python Modules
RUN pip3 install flask
RUN pip3 install cffi
RUN pip3 install gunicorn
RUN pip3 install gevent
RUN pip3 install requests

# Clean APK cache
RUN rm -rf /var/cache/apk/*

ENV SYSTEM_ENVIRONMENT=prod
ENV SYSTEM_PLATFORM=heroku
ADD ./cred /opt/cred
ADD ./data /opt/data
ADD ./server /opt/server
CMD gunicorn -k gevent -w 1 --chdir /opt/server launch:app -b 0.0.0.0:$PORT

heroku container:push should allow specifying a build context path

heroku container:push doens't build the images correctly if the Dockerfile is not on the project root.

I keep Dockerfiles on a separate folder and currently build the images with docker build -f docker/Dockerfile.web .

Adding a way to specify the build context path would allow me to build using heroku container:push --recursive --path .

heroku container:push causes COPY instruction failure

  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

COPY should work with relative paths

Actual behavior

An error occurs when trying to COPY:

Sending build context to Docker daemon  9.216kB
Step 1/25 : FROM python:3.6-alpine
 ---> c3a4a35c9244
Step 2/25 : ENV PYTHONUNBUFFERED 1
 ---> Using cache
 ---> 73473a868596
Step 3/25 : RUN apk update   && apk add --virtual build-deps gcc python3-dev musl-dev   && apk add postgresql-dev   && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev   && apk add libffi-dev openssl-dev py-cffi
 ---> Using cache
 ---> 836535f4c88d
Step 4/25 : RUN addgroup -S django     && adduser -S -G django django
 ---> Using cache
 ---> 16e570f295a7
Step 5/25 : COPY ./requirements /requirements
COPY failed: stat /var/lib/docker/tmp/docker-builder562137812/requirements: no such file or directory
 ▸    Error: docker build exited with 1

Output of docker-compose version

docker-compose version 1.16.1, build 6d1ac21
docker-py version: 2.5.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016

Output of docker version:

Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: darwin/amd64

Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: true

Output of docker info:

Containers: 7
Running: 3
Paused: 0
Stopped: 4
Images: 180
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: moby
ID: BXBD:PDCF:AE7P:3TC3:5PS6:Z4I5:FYNS:3ZPO:WFKY:BFNF:2EAZ:3POV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 44
Goroutines: 50
System Time: 2018-03-22T00:27:48.196365212Z
EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

Additional detail

I have been running docker-compose -f production.yml build followed by docker-compose -f production.yml up for a docker-compose ps of

        Name                       Command               State     Ports  
--------------------------------------------------------------------------
luup_caddy_1          /usr/bin/caddy --conf /etc ...   Exit 1           
luup_celerybeat_1     /entrypoint.sh /start-cele ...   Exit 2           
luup_celeryworker_1   /entrypoint.sh /start-cele ...   Exit 2           
luup_django_1         /entrypoint.sh /gunicorn.sh      Up               
luup_postgres_1       docker-entrypoint.sh postgres    Up       5432/tcp
luup_redis_1          docker-entrypoint.sh redis ...   Up       6379/tcp  

I can login according to these instructions using the Heroku CLI without a problem.
Following these instructions I have renamed each of my Dockerfiles to Dockerfile.uniqueProcessType and am pushing using heroku container:push django caddy postgres --recursive.

Any of the Dockerfiles I heroku container:push --recursive will return the same COPY failed: stat /var/lib/docker/tmp/docker-builder014946065/requirements: no such file or directory ▸ Error: docker build exited with 1

I have tried running the command in all levels of the tree.

I have also tried incrementally removing partial to all of my .dockerignore in case.

docker-compose -f production.yml build or docker-compose -f local.yml build will build without issue.

Unable to login from Windows 8.1

I'm on Windows 8.1 with Docker toolbox and Heroku CLI installed.

I get the following error when trying to login to Container Registry:

user@PC MSYS ~                                                                                   
$ heroku --version                                                                                
heroku-cli/6.15.22-3f1c4bd (win32-x64) node-v9.3.0                                                
                                                                                                  
user@PC MSYS ~                                                                                   
$ docker --version                                                                                
Docker version 17.10.0-ce, build f4ffd25                                                          
                                                                                                  
user@PC MSYS ~                                                                                   
$ docker-machine ls                                                                               
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           v17.09.1-ce         
                                                                                                  
user@PC MSYS ~                                                                                   
$ heroku container:login                                                                          
Incorrect function.                                                                               
 !    Error: docker login exited with 1                                                                                                                                                        

Provide optional "release on push" functionality for Docker deployments

I understand the benefits of separating the Docker registry push and the actual Heroku release. But in many use cases it is convenient if a release is done automatically directly after a successful push (This was the Heroku default before May 29th).

It would be great if you could provide a switch or option to enable this feature again.

Thanks

Kai

"Bad argument" error

I am getting a "Bad argument" error running heroku container:login and heroku container:push. See below for version information and repro steps.

image

cc @dickeyxxx

files attribute missing from package.json

Just installed / upgrade the heroku container registry plugin.
heroku plugins:install @ heroku-cli/plugin-container-registry

System:
GalliumOS (Debian)
nvm virtual package manager for npm

Then ran:
heroku --version

Error Message:
(node:16573) Error Plugin: heroku-container-registry: files attribute must be specified in /home/rcj1492/.local/share/heroku/node_modules/heroku-container-registry/package.json
module: @oclif/[email protected]
plugin: heroku-container-registry
root: /home/rcj1492/.local/share/heroku/node_modules/heroku-container-registry
See more details with DEBUG=*
(node:16573) Error Plugin: heroku-container-registry: files attribute must be specified in /home/rcj1492/.local/share/heroku/node_modules/heroku-container-registry/package.json
module: @oclif/[email protected]
plugin: heroku-container-registry
root: /home/rcj1492/.local/share/heroku/node_modules/heroku-container-registry
See more details with DEBUG=*
heroku/7.0.85 linux-x64 node-v8.9.1

Workaround:
I added "files": [] to package.json and error goes away.

Expected response to be successful, got 422

I was redirected here from heroku/cli.

I'm trying to perform a container release but I keep getting 422 error message. I've tracked it down to the add-ons I'm choosing. I can deploy with only heroku-postgresql but as soon as I add some of my other addons (logentries, newrelic, rollbar, scheduler, sendgrid) it returns a 422.

Here's the log with HEROKU_DEBUG=1:

heroku-cli/5.2.24-4b7e305 (darwin-amd64) go1.6.2 /Users/jfloff/.local/share/heroku/cli/bin/heroku cmd: version
heroku-cli/5.2.24-4b7e305 (darwin-amd64) go1.6.2 /Users/jfloff/.local/share/heroku/cli/bin/heroku cmd: commands
heroku-cli/5.2.24-4b7e305 (darwin-amd64) go1.6.2 /Users/jfloff/.local/share/heroku/cli/bin/heroku cmd: container:release
Remote addons: heroku-postgresql (1)
Local addons: heroku-postgresql:hobby-dev, logentries:le_tryit, newrelic:wayne, rollbar:free, scheduler:standard, sendgrid:starter (6)
Missing addons: logentries:le_tryit, newrelic:wayne, rollbar:free, scheduler:standard, sendgrid:starter (5)
Provisioning logentries:le_tryit...
Provisioning newrelic:wayne...
Provisioning rollbar:free...
Provisioning scheduler:standard...
Provisioning sendgrid:starter...

can not install heroku-container-registry

My circle-ci deployment failed with the following error, please check this.

set git remote heroku to https://git.heroku.com/repo-name.git
 ▸    heroku-cli: update available from 6.12.9 to 6.13.19-6cd27b3
Installing plugin heroku-container-registry... !
 ▸    yarn --non-interactive --mutex=file:/home/ubuntu/.cache/heroku/yarn
 ▸    --cache-folder=/home/ubuntu/.cache/heroku/yarn exited with code 1
 ▸    error An unexpected error occurred:
 ▸    "http://cli-npm.heroku.com/mimic-fn/-/mimic-fn-1.1.0/e667783d92e89dbd342818b5230b9d62a672ad18/e667783d92e89dbd342818b5230b9d62a672ad18.tgz:
 ▸    Request failed \"500 Internal Server Error\"".
 ▸    

     ▸    heroku-cli: update available from 6.12.9 to 6.13.19-6cd27b3
     ▸    container:push is not a heroku command.
     ▸    Perhaps you meant commands
     ▸    Run heroku help for a list of available commands.

Sanbashi is not defined

Today I installed the Heroku CLI from Homebrew (v6.12.6) on MacOS. I then installed the heroku-container-registry plugin. The login command fails with the following error:

$ heroku container:login
 ▸    Error: docker login exited with ReferenceError: Sanbashi is not defined

On another machine running Heroku CLI v6.7.4 I am not seeing this issue.

Error pushing docker container

When I run heroku container:push cli I get the following output:

unable to prepare context: unable to evaluate symlinks in context path: lstat /Users/chris.castle/src/support-docker-cli/undefined: no such file or directory
 ▸    Error: docker build exited with 1

Not sure if this is an issue with my Docker.app install, but I was able to build, run, and use the container locally using the following steps:

  1. docker build . in directory cloned from https://github.com/heroku/support-docker-cli. This built the docker image successfully.
  2. docker images to get the IMAGE ID
  3. docker run -it -e HEROKU_API_TOKEN=$(heroku auth:token) 0f3d3e0f00f8

My understanding is that herouk container:push [PROCESS TYPE] should build and deploy the container to Heroku.

Version information:
image

heroku container:login ERROR !

I am trying out the container registry following the getting started tutorial here - https://devcenter.heroku.com/articles/container-registry-and-runtime

heroku container:login gives error, it seems to be looking for the docker registry on localhost instead of registry.heroku.com (I guess). See snap shot :
heroku-docker registry error

I have also tried to use docker to login to the registry with my heroku account detail also no luck.
I am using a windows 8.1 machine and it is the same result on cmd

#27 appears to have broken the CLI component

PR #27 added support for pass-by-stdin for Docker. This is fine by itself, but it also included references to an undefined variable options. This unfortunately breaks the plugin and is preventing login/deployment/etc via the heroku container registry.

Steps to reproduce:

  1. Run heroku container:login

Expected:

Successful login

Actual:

▸ Error: docker login exited with ReferenceError: options is not defined

Backtrace

ReferenceError: options is not defined
    at Function.Sanbashi.cmd (/home/blah/.local/share/heroku/plugins/node_modules/heroku-container-registry/lib/sanbashi.js:126:3)
    at dockerLogin (/home/blah/.local/share/heroku/plugins/node_modules/heroku-container-registry/commands/login.js:43:19)
    at login (/home/blah/.local/share/heroku/plugins/node_modules/heroku-container-registry/commands/login.js:25:22)
    at run (/home/blah/.local/share/heroku/plugins/node_modules/heroku-cli-util/lib/command.js:159:15)
    at Object.run (/home/blah/.local/share/heroku/plugins/node_modules/heroku-cli-util/lib/command.js:171:12)
    at V5.run (/usr/lib/heroku/lib/legacy.js:58:16)
    at Function.run (/usr/lib/heroku/node_modules/cli-engine-command/lib/command.js:52:17)
    at <anonymous>

Error: Cannot find module 'inflection'

Trying to install heroku-container-registry errors out with Error: Cannot find module 'inflection'

nchen@nchen-wsm1:~/Development|⇒  heroku --version
heroku-toolbelt/3.43.13 (x86_64-darwin10.8.0) ruby/1.9.3
heroku-cli/5.5.0-f6e6aaf (darwin-amd64) go1.7.3
nchen@nchen-wsm1:~/Development|⇒  heroku plugins:install heroku-container-registry
Installing plugin heroku-container-registry...module.js:442
    throw err;
    ^

Error: Cannot find module 'inflection'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/nchen/.local/share/heroku/plugins/node_modules/heroku-client/lib/resourceBuilder.js:4:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
 !
 ▸    Error installing plugin heroku-container-registry
 !    error installing plugin heroku-container-registry

ESOCKETTIMEDOUT on running `heroku plugins:install heroku-container-registry`

I am running heroku plugins:install heroku-container-registry on local machine and getting this error. I am copy/pasting the contents of "yarn-error.log" here

Arguments: 
  /usr/lib/heroku/bin/node /usr/lib/heroku/node_modules/yarn/bin/yarn.js add heroku-container-registry@latest --non-interactive --mutex=file:/home/khurram/.local/share/heroku/plugins/yarn.lock --preferred-cache-folder=/home/khurram/.cache/heroku/yarn --registry=https://cli-npm.heroku.com

PATH: 
  /usr/lib/heroku/bin:/home/khurram/miniconda3/bin:/usr/local/cuda-9.0/bin:/home/khurram/bin:/home/khurram/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Yarn version: 
  1.6.0

Node version: 
  9.11.1

Platform: 
  linux x64

Trace: 
  Error: http://cli-npm.heroku.com/rx/-/rx-4.1.0/a5f13ff79ef3b740fe30aa803fb09f98805d4782.tgz: ESOCKETTIMEDOUT
      at ClientRequest.<anonymous> (/usr/lib/heroku/node_modules/yarn/lib/cli.js:133786:19)
      at Object.onceWrapper (events.js:272:13)
      at ClientRequest.emit (events.js:180:13)
      at Socket.emitTimeout (_http_client.js:703:34)
      at Object.onceWrapper (events.js:272:13)
      at Socket.emit (events.js:180:13)
      at Socket._onTimeout (net.js:396:8)
      at ontimeout (timers.js:466:11)
      at tryOnTimeout (timers.js:304:5)
      at Timer.listOnTimeout (timers.js:267:5)

npm manifest: 
  {
    "private": true,
    "cli-engine": {
      "schema": 1
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Unable to login

I got the following error message during heroku container:login

Error: docker login exited with ReferenceError: options is not defined 

versions:

$ heroku --version
heroku-cli/6.14.43-73d5876 (darwin-x64) node-v9.2.0

$ heroku plugins
heroku-accounts 1.1.5
heroku-ci 1.9.5
heroku-container-registry 4.4.2
heroku-container-tools 4.0.0

$ docker --version
Docker version 17.12.0-ce-rc4, build 6a2c058

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.