Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    gphilp
    @gregorphilp
    oh ok. I see
    I need to use app.py
    gphilp
    @gregorphilp
    ok cool
    ubuntu@ip-172-31-42-198:~/github/docker-flask$ docker run -it --rm --name my-running-app my-python-app
    should I be able to browse to that address?
    Andrew Tork Baker
    @atbaker
    @gregorphilp - You should be able to browse to the http://[your cloud server’s hostname]:5000
    gphilp
    @gregorphilp
    ok, I tried that...maybe just too slow
    Andrew Tork Baker
    @atbaker
    @gregorphilp - you may also need to pass a -p option to expose the container port to the host
    gphilp
    @gregorphilp
    -p 5000:80
    rmitz
    @rmitz
    Anyone seeing an issue with authentication failing on the final docker push?
    Andrew Tork Baker
    @atbaker
    @rmitz - did you tag your image in your namespace instead of atbaker?
    Sri Radhakrishna
    @sradhakrishna-rms
    @atbaker If I am using the cloud server should I pull down the Git repo for Flask locally?
    rmitz
    @rmitz
    ah, wasn't clear that was a global namespace
    Andrew Tork Baker
    @atbaker
    @sradhakrishna-rms - pull it down to the cloud server! :smile:
    Sri Radhakrishna
    @sradhakrishna-rms
    @atbaker ubuntu@ip-172-31-42-229:~/docker-flask$ python app.py .
    Traceback (most recent call last):
    File "app.py", line 1, in <module>
    from flask import Flask
    ImportError: No module named flask
    rmitz
    @rmitz
    The final push seems to be taking a few retries even from the cloud servers.
    Andrew Tork Baker
    @atbaker
    @sradhakrishna-rms - you need to run sudo pip install -r requirements.txt if you want to run the app outside of Docker
    Sri Radhakrishna
    @sradhakrishna-rms
    @atbaker requirements.txt was successful (no problems there).. running of teh actual app.py is failing..sorry, not a python guy
    H. Wade Minter
    @minter
    Was hoping that break would unstick this: Repository python already being pulled by another client. Waiting
    Thanks to @atbaker - did a "boot2docker restart" and it seems to have unstuck it!
    Benjamin Goh
    @masotime
    i'm now pushing to the docker hub. I have to say that it is pretty network intensive. When I push an image, I see that it is pushing many (what I assume are) "sub-images". Are these the "dependencies" for the main image / app?
    Sri Radhakrishna
    @sradhakrishna-rms
    @atbaker ubuntu@ip-172-31-42-229:~/docker-flask$ docker build -t flask-app .
    Sending build context to Docker daemon 70.66 kB
    Sending build context to Docker daemon
    Step 0 : PYTHON:3-ONBUILD
    Andrew Tork Baker
    @atbaker
    @masotime - the first push for an image is always a little intense, but subsequent pushes will only push the layers of the filesystem that changed. But you’re right that first push can take a little bit
    Shaun Adkins
    @adkinsrs
    Random question. Can you select multiple base images for your Dockerfile or does it have to be exactly one?
    Sri Radhakrishna
    @sradhakrishna-rms
    @atbaker never mind I got the build to work.
    Andrew Tork Baker
    @atbaker
    @sradhakrishna-rms woo!
    JK
    @masterjk
    @atbaker after running docker build -t flask-app ., curious as to where does it store the "image" or artifacts?
    Andrew Tork Baker
    @atbaker
    @masterjk - I think it might differ by Linux distribution, but I’m sure a search for “where does Docker store images [your distro]” could come up with the right answer
    @adkinsrs - A Dockerfile can have only one base image. If you need components from two base images, it’s easiest to pick one and then add the Dockerfile commands from the other to your Dockerfile
    Shaun Adkins
    @adkinsrs
    @atbaker thanks!
    @atbaker also when specify the app.py command path, where is the command relative to? Or should I just go ahead and use the absolute filepath name
    Andrew Tork Baker
    @atbaker
    @adkinsrs - it’s relative to the WORKDIR command of the Dockerfile. If you’re using the python:3-onbuild image, that WORKDIR is set for you in the base image and is /usr/src/app
    @adkinsrs Most of the time I use relative paths with Dockerfile CMDs though
    Sri Radhakrishna
    @sradhakrishna-rms
    @atbaker my push failed
    Andrew Tork Baker
    @atbaker
    @sradhakrishna-rms - did you tag your docker build in your namespace instead of atbaker? That’s one possible issue
    Sri Radhakrishna
    @sradhakrishna-rms
    @atbaker It could just be the slow internet here. Error pushing to registry: Server error: 500 trying to push vatsa82/flask-app blob - sha256:9f615073df3ad2c2265da2a1e16713c8182f121f25723a5c322526b61119c176
    Andrew Tork Baker
    @atbaker
    @sradhakrishna-rms - hmm, that does look right
    @sradhakrishna-rms my bet is bad internet unfortunately. You can skip that step and go to the next section
    Aaron Sumner
    @ruralocity
    @atbaker I'm tethered to my phone and the push seems to work, but is slow. It's currently pushing a 128.2 MB image ... does that seem right?
    Andrew Tork Baker
    @atbaker
    @ruralocity - for the first push of a repo that’s not a crazy size. If that’s slowing you down you can skip that step
    Aaron Sumner
    @ruralocity
    @atbaker cool, thanks.
    djdrisco
    @djdrisco
    apt-get install -y mongodb-10gen , return error unable to locate package mongdb-10gen , thoughts? Should I just use latest and greatest mongodb, using apt-get install -y mongodb-org ?
    Andrew Tork Baker
    @atbaker
    @djdrisco - I put that MongoDB Dockerfile in there as an example, but you don’t need to run it (and it might be out of date!)
    georgecook-cbt
    @georgecook-cbt
    Usually if you're installing mongo on ubuntu you need to add a mongo repo to your apt list if I recall
    Ilya Lipnitskiy
    @lipnitsk
    The EXPOSE keyword doesn't really seem to affect what port is exposed. ie the app.py server listens on 5000, and if I forward 8000 to 5000 with docker run -p 8000:5000, the app still runs. Is EXPOSE really needed in our Dockerfile?
    Andrew Tork Baker
    @atbaker
    @lipnitsk You’re right - most of the time you’ll set port forwarding settings with docker run. But if you pass the -P flag to docker run, it will map the exposed port from the Dockerfile to the first available port on the host, which is handy
    @lipnitsk - I mostly put EXPOSE in my Dockerfiles to help me remember which port is important for that app
    djdrisco
    @djdrisco
    thanks. I ended add mongodb to my apt list using this:http://docs.mongodb.org/v2.2/tutorial/install-mongodb-on-ubuntu/
    Ilya Lipnitskiy
    @lipnitsk
    @atbaker thanks, makes sense.
    skymix
    @skymix
    at final of the build i get some strange errors:
    Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', gaierror(-2, 'Name or service not known'))': /simple/flask/
    But in my local pc with fedora i could make the pip install correctly.