Coder Social home page Coder Social logo

ec2-docker-demo's Introduction

This is a basic flask app docker container. To run it locally, run cmd: docker-compose up --build from the project directory in terminal.

When the container is running, it will be attached to port 80 of the local machine, go to: http://localhost:80 to view the site.

Flask, by default, is running on port 5000 of the container, but the docker-compose binds host port 80 to container port 5000.

The following steps below only work if your local machine has same cpu arch as the ec2 instance (x86 or arm): To build the docker image locally, run command: docker build -t ec2-flask-demo:v1.0 . from project dir

Next, we need to save the image as a tarball to compress the artifact before uploading it to the ec2 instance, run cmd: docker save -o ec2-flask-demo.tar ec2-flask-demo:v1.0 - there should now be a .tar file in the project dir.

Now, we are going to upload the tar file to the ec2 instance using scp: scp -i vs-kp-1.pem ec2-flask-demo.tar [email protected]:/home/ec2-user/docker_images We get an error if we haven't set the permissions on the .pem file, need to run: chmod 600 vs-kp-1.pem

The size of the demo docker image tar file is 162 MB - if you run ls from within the ec2 instance, we can now see it.

ec2-docker-demo's People

Contributors

vastevenson 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.