commit 62fcb2cd36314150b7176d4a2b5de5c64e626030 Author: Adrien-Ba <45963338+Adrien-Ba@users.noreply.github.com> Date: Mon Oct 4 09:38:35 2021 +0200 Initial commit diff --git a/0_run/Readme.md b/0_run/Readme.md new file mode 100644 index 0000000..41a8ecb --- /dev/null +++ b/0_run/Readme.md @@ -0,0 +1,36 @@ +# Run TP + +Add all of thoses script in the `commands.sh` file + +## Hello docker + +I want a docker run command to show this using the `docker/whalesay` image : + + +```bash + __________________ +< Hello M1 III 2021 > + ------------------ + \ + \ + \ + ## . + ## ## ## == + ## ## ## ## === + /""""""""""""""""___/ === + ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ + \______ o __/ + \ \ __/ + \____\______/ +``` + +And I want, with that same command, for the container to be **deleted**. + + +## Interactive python shell + +I don't have admin rights on my computer and I want to test something with python 3. + +With a `docker container run`, start an **interactive** container with python 3 running. + +And I want, with that same command, for the container to be **deleted** when I'm done. diff --git a/0_run/commands.sh b/0_run/commands.sh new file mode 100644 index 0000000..cc1f786 --- /dev/null +++ b/0_run/commands.sh @@ -0,0 +1 @@ +#!/bin/bash \ No newline at end of file diff --git a/1_dockerfile/Readme.md b/1_dockerfile/Readme.md new file mode 100644 index 0000000..7361a11 --- /dev/null +++ b/1_dockerfile/Readme.md @@ -0,0 +1,51 @@ +# Dockerfile tp + +Write dockerfile for each folder. + +## Package curl + +My computer dosen't have curl installed, and I want a docker to run curl on my laptop (as shown with python in the previous tp). + +I want to be able to do this : + +```bash +cd curl +docker image build -t my-curl . +``` + +And then, run it. + +You have to do is to **write the Dockerfile**. + +I want to use it like that : + +```bash +docker container run --rm my-curl:latest https://example.com +``` + +## Package my bash script + +I want the script in the folder bash to be run within a `ubuntu` container. + +**You must write the dockerfile.** + + +## Package a python app + +I want my python app to be packaged in a docker container using python **2.7**. + +You have to do is to **write the Dockerfile**. + +I want to run it like that : + +```bash +docker run -d -p 5000:5000 my-hello-world +``` + +And I want it to be pushed on docker hub. + +Tips : + +To install dependancies, you must run `pip install -r requirements.txt` in the container. + +Don't forget to copy requirements.txt too ! diff --git a/1_dockerfile/bash/Dockerfile b/1_dockerfile/bash/Dockerfile new file mode 100644 index 0000000..e69de29 diff --git a/1_dockerfile/bash/to_run.sh b/1_dockerfile/bash/to_run.sh new file mode 100755 index 0000000..795f12a --- /dev/null +++ b/1_dockerfile/bash/to_run.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +RELEASE=$(head -n 1 < /etc/lsb-release | cut -d '=' -f 2) + +if [ "$RELEASE" = "Ubuntu" ]; then + echo Good ! It\'s Ubuntu +else + echo Oh no, i\'ts not Ubuntu... +fi diff --git a/1_dockerfile/curl/Dockerfile b/1_dockerfile/curl/Dockerfile new file mode 100644 index 0000000..e69de29 diff --git a/1_dockerfile/python/Dockerfile b/1_dockerfile/python/Dockerfile new file mode 100644 index 0000000..e69de29 diff --git a/1_dockerfile/python/app.py b/1_dockerfile/python/app.py new file mode 100644 index 0000000..e9a108e --- /dev/null +++ b/1_dockerfile/python/app.py @@ -0,0 +1,15 @@ +# app.py - a minimal flask api using flask_restful +from flask import Flask +from flask_restful import Resource, Api + +app = Flask(__name__) +api = Api(app) + +class HelloWorld(Resource): + def get(self): + return {'hello': 'world'} + +api.add_resource(HelloWorld, '/') + +if __name__ == '__main__': + app.run(debug=True, host='0.0.0.0') \ No newline at end of file diff --git a/1_dockerfile/python/requirements.txt b/1_dockerfile/python/requirements.txt new file mode 100644 index 0000000..1aff942 --- /dev/null +++ b/1_dockerfile/python/requirements.txt @@ -0,0 +1,2 @@ +flask +flask_restful \ No newline at end of file diff --git a/2_compose/Readme.md b/2_compose/Readme.md new file mode 100644 index 0000000..75f7e49 --- /dev/null +++ b/2_compose/Readme.md @@ -0,0 +1,5 @@ +# Convos docker compose + +I want a `docker-compose.yml` to start a convos (https://convos.chat/) on the port 2021 and persist the data in a folder of your choise. + +**You must write the docker-compose.yml.** \ No newline at end of file diff --git a/2_compose/docker-compose.yml b/2_compose/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..cb3ee74 --- /dev/null +++ b/Readme.md @@ -0,0 +1,10 @@ +# TP Docker + + +First of all, click the "This template" button to create your repo. + +Then, you must folow each folders to see what you must do. + +Then, you must submit on the https://courso.beaussan.io/ platform (Login with the email you provided in the last TP). + +You must submit the public url of the repo **once you are done**. And when you submit, the repo needs to be public. \ No newline at end of file