Docker для python. Первые шаги

Если не вдаваться в технические детали Docker ближе всего к VirtualBox, VMware или другим средствам виртуализации. Технические отличия заключаются в других способах изоляции запускаемой гостевой (guest) операционной системы и разделения ресурсов основной (host) операционной системы. Как правило каждый работающий в Docker экземпляр гостевой операционной системы предназначен для запуска одного единственного приложения. При этом задействуется меньше ресурсов, чем при запуске в виртуальной машине. Для этого создается своя файловая система, свои виртуальные сетевые интерфейсы - как бы контейнер внутри которого приложение работает....

January 4, 2022

Starting a remote docker development server on DigitalOcean droplet

Thanks Fedor Borshev for awesome tutorial “Как писать код на МОЩНОЙ удалённой машине DigitalOcean”. I repeated Fedor’s experience with Windows + WSL2. Video: Link to ansible playbook for for deploying docker on DO droplet and empty django project for testing: github. Links: [1] Ansible playbook for for deploying docker on DO droplet [2] Youtube-канал “Почему не работает?”

August 15, 2021

Setup a basic workflow using GitHub Actions with Docker

In the continuation of the post “Creating dockerized Django app with VSCode”, I updated the source code to work with GitHub Actions. Setup a basic workflow using GitHub Actions Add to the requirements.txt file the following line to check with linter: flake8>=3.9.2,<3.10 Create a new file at .github/workflows/cd.yml and fill it with the following contents: --- name: Code checks on: push: branches: [ master ] pull_request: branches: [ master ] jobs: test: name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Test run: docker-compose run --rm ....

June 13, 2021

Creating dockerized Django app with VSCode

Thanks to Mark Winterbottom for the interesting videos and the idea for this post. Creating a Django project Start by creating a new directory for your project (eg: vscode-django-docker), and open it in VSCode. mkdir vscode-django-docker cd vscode-django-docker git init code . Then, add a .gitignore for your project. You can use template for Python provided by GitHub or generate on gitignore.io. Now let’s create a Django project by running the one-line-command below...

June 12, 2021

Manage Docker without sudo and clean up used disk space

Manage Docker without sudo There are official guidelines for managing Docker as a non-root user. Summary: add user to docker group $ sudo gpasswd -a $USER docker If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect. On a desktop Linux environment, log out of your session completely and then log back in. On other cases for Linux, you can also run the following command to activate the changes to groups:...

March 13, 2021

Facial recognition with Python

I tried the facial recognition library for Python ageitgey/face_recognition. This library uses dlib, a toolkit written in C++ that contains machine learning algorithms. For example, I’m trying to check if an actor is playing in the TV series “The Big Bang Theory”. A test image with an actor is compared to real actors filmed in a TV show. I wrote a web service that uses python face_recognition library for face recognition from image and compares the recognized face with the data stored in the database....

January 18, 2021

Start Ansible for Docker containers

For some pet projects, I need multiple instances of different servers. The best way is to use Docker. And the best way to automate configuration services that run in docker containers is Ansible. This is the sequence of steps to run Ansible to configure containerized services in Ubuntu. Installing Docker Engine on Ubuntu is very well described on the official website. A summary of the steps: sudo apt-get update sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common curl -fsSL https://download....

September 19, 2020