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

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

<span title='2022-01-04 00:00:00 +0000 UTC'>January 4, 2022</span>

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-канал “Почему не работает?”

<span title='2021-08-15 00:00:00 +0000 UTC'>August 15, 2021</span>

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 . sh -c "python manage.py test" lint: name: Lint runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Lint run: docker-compose run --rm . sh -c "flake8" To add a cool badge I updated README.md with the following link: ...

<span title='2021-06-13 00:00:00 +0000 UTC'>June 13, 2021</span>

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

<span title='2021-06-12 00:00:00 +0000 UTC'>June 12, 2021</span>

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

<span title='2021-03-13 00:00:00 +0000 UTC'>March 13, 2021</span>

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

<span title='2021-01-18 00:00:00 +0000 UTC'>January 18, 2021</span>

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.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io sudo docker run hello-world The last command is used to verify successful installation. ...

<span title='2020-09-19 00:00:00 +0000 UTC'>September 19, 2020</span>