Coder Social home page Coder Social logo

pfa-docker-challenge-1's Introduction

PFA Docker - Challenge 1

Create a program, using your favorite programming language, that makes a simple list with the name of some of the Full Cycle course modules, querying them from a MySQL database. Generate an image of this container and publish it on Docker Hub.

Generate a nginx image that can receive http requests and foward them to the container.

Create a repository on GitHub with the source code for the program and images generated.

Create a README.md file specifying which commands needs to be executed to run the app receiving requests on the port 8080 of the host computer. Remembering NOT to use docker-compose on this challenge.

How to Run

  • First create a network in order to connect the containers:

    docker network create pfa_docker_1
  • Run MySql:

    docker run --rm -dit -v "${PWD}"/mysql/dbdata:/var/lib/mysql \
               -e MYSQL_DATABASE=pfa_docker_1 \
               -e MYSQL_ROOT_PASSWORD=root \
               --name pfa-docker-1-mysql \
               --network pfa_docker_1 \
               mysql:5.7 --innodb-use-native-aio=0
  • Run the node app:

    docker run --rm -dit --name pfa-docker-1-node \
               --network pfa_docker_1 \
               felipefa/pfa-docker-1-node
  • Run nginx:

    docker run --rm -d --name pfa-docker-1-nginx \
               --network pfa_docker_1 \
               -p 8080:80 \
               felipefa/pfa-docker-1-nginx

Result

Open http://localhost:8080 on your preferred browser and you should see a list with some of the Full Cycle course module names.

[
  {
    "name": "Docker"
  },
  {
    "name": "Kubernetes"
  },
  {
    "name": "RabbitMQ"
  },
  {
    "name": "Apache Kafka"
  }
]
Pro tip: use the JSON Viewer web browser extension to see formatted JSON data on the browser.

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.