This is part two in a series on taking a simple Python project from local script to production. In part one I talked about a gotcha I ran into when...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for putting this together! One thing I'd strongly suggest to do is to define a
USER
in your Dockerfile. If you don't do this, the container (typically) unnecessarily runs as root, which is a big anti-pattern. Unfortunately, we still find way over half of the images on Dockerhub not defining a user due to a lack of education. See also canihaznonprivilegedcontainers.info where we provide some more background.I had no idea but this is great information. I will update this tutorial and the sample images on dockerhub so I’m not helping perpetuate an anitpattern. Thank you!
Thank you and KUTGW!
Nice write-up :)
Why push an image and not use the docker hub functionality to build images? Is there a specific reason for that?
Pushing an image to Dockerhub makes it available in a wider variety of contexts because other sources can pull it down. Later in this series I'm going to talk about using Docker images for AWS Fargate tasks, and I need to make the Docker image available in a public registry for that.
I'm definitely doing things here and there in these tutorials that might be immediately unnecessary, but are laying groundwork for future tutorials.
But if I use docker hub to build my images, other sources can pull it down too right? Or am I wrong about that? :s
I'm talking about this: docs.docker.com/docker-hub/builds/
Oh, I completely misunderstood your comment. Sorry!
There's no reason you couldn't build an image from a github or bitbucket repository, but part of the point of this tutorial is to introduce Dockerhub as a concept, and this is a simpler, more isolated experience, in my opinion. If you are already using Docker and building images from a source control integration, you're probably more advanced than the target audience for this tutorial :)
Additionally, it seemed a bit complicated to add another integration into this tutorial. It would have gotten overly long. But Using docker hub to build images from an external repository makes a lot of sense, especially if you anticipate the code changing a lot. Both are valid ways to go about things.
Thanks! I know docker hub, but a Dockerfile I need to look up everything, so I'm not that advanced :)
I was following the tutorial and I am stuck on this step:
(base) C:\PycharmProjects\docker-workshop>docker run goodreads-libib-container
The command above produces the next error:
Unable to find image 'goodreads-libib-container:latest' locally
docker: Error response from daemon: pull access denied for goodreads-libib-container, repository does not exist or may require 'docker login': denied: requested access to the resource is
denied.
See 'docker run --help'.
I haven't touched the docker repo in a while. It should be publicly accessible, but I'm not sure. Let me take a look at the permissions and see if I can fix that for you. I'll probably get to this in the next couple of days.
Thank you so much Jess!
This really helped me a lot
Thank you - great post with (for me) just the right amount of context.
Please help through setting up docker container with nginx
That's a good idea for a future post. I don't have a specific outline for that tutorial at the moment, but I'll work on outlining it. Thanks for the idea!
Hi Jess, your both articles are really helpful and I am really looking forward to the next AWS series. Keep up with the good work :)