Showing posts with label docker. Show all posts
Showing posts with label docker. Show all posts

Thursday, March 16, 2023

Run X11 application in docker

 To run X11 / X-Window application in docker, the following tutorial provides a simple approach to archive it:

https://blog.yadutaf.fr/2017/09/10/running-a-graphical-app-in-a-docker-container-on-a-remote-server/

Tuesday, December 17, 2019

Create docker container with the simple flask application

I will try to create a docker container with the simple flask application created some times ago.



First, I create a shell script for starting the flask application, namely "boot.sh":

boot.sh
#!/bin/sh
export FLASK_APP=simple.py
flask run --host 0.0.0.0



Second, we need to create a requirements.txt file:

requirements.txt
flask==1.1.1

Actually you can run the following to get the requirements.txt:

pip freeze > requirements.txt



Third, together with the simple.py file created in the simple flask application, put those 3 files in an "app" directory:

app/
   - boot.sh
   - requirements.txt
   - simple.py



Forth, create a Docker file outside the app directory:

Dockerfile
FROM python:3.6-alpine
WORKDIR /home/app
COPY app/ ./
RUN chmod +x ./boot.sh
RUN pip install -r requirements.txt
EXPOSE 5000
ENTRYPOINT ["./boot.sh"]

Build the docker image using the Dockerfile:

     docker build -t simple:latest .

Run the docker container with the docker image we just created:

     docker run -d -p 5000:5000 simple:latest

Check "http://localhost:5000" to check the Flask application.

CSP on Apache

To add CSP to root if sort of funny. The following will NOT work for most cases !!     <LocationMatch "^/$">        Header s...