Giter Site home page Giter Site logo

dockerize-python-flask's Introduction

Dockerizing a flask application

  1. Clone the repo
git clone https://github.com/IBT-learning/dockerize-python-flask
  1. Create a Dockerfile

Create a Dockerfile in this directory and start editing it with your favorite text editor. The solution is in the solution branch, but try to build it yourself. You will need to use the instructions below to create a Docker image.

FROM: Specifies the base image to use for the build. RUN: Runs a command during the image build process. COPY: Copies files or directories from the host file system into the container file system. WORKDIR: Sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions. EXPOSE: Specifies the network ports that the container listens on at runtime. CMD: Specifies the default command to run when the container starts.

  1. Build your image
docker build -t myflask:v1.0.0 .
  1. Run your docker container
docker run -d -p 8337:3000 myflask:v1.0.0
  1. Verify your container started

Find the container id and it's status

docker ps -a

If the status isn't running, troubleshoot with the docker logs command

docker logs <container-id>
  1. Test your container
curl http://localhost:8337

Challenage

Create a docker compose file for your application

Having issues with the basic lab? Here is the solution steps:

https://gist.github.com/devopswithbrad/77ad3255cdf21edb2da29fa46cb5a77a

dockerize-python-flask's People

Contributors

devopswithbrad avatar

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.