Btw - people who get to this exercise early, let me know if you hit any bugs! That way I can fix and push updates before everyone else gets here
gphilp
@gregorphilp
hi
Im getting this error when trying to run my-python-app using the image I just built
ubuntu@ip-172-31-42-198:~/github/docker-flask$ docker run -it --rm --name my-running-app my-python-app python: can't open file './your-daemon-or-script.py': [Errno 2] No such file or directory
Andrew Tork Baker
@atbaker
@gregorphilp - that sounds like a problem with the CMD part of your Dockerfile. It should use a file that’s in the repo as part of the command
gphilp
@gregorphilp
yeah, that file isnt there
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
@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
@atbakerubuntu@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?
@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