6/19/2017

Running Qt GUI apps with Docker

  In the past three weeks, I was playing around Docker and CI/CD pipeline, and I was getting familiar with Docker and its toolbox. In the meanwhile, I tried to dockerize most of my own applications, tools, and algorithms which can run, build, or test inside Docker container.
  Here is one of my projects on Github, it's called labelImg which was written in Python + PyQt. You can follow the below videos or the snippet of the commands to run Python + PyQt GUI application inside the Docker container.

Step1: Clone the source code from Github
$ git clone https://github.com/tzutalin/labelImg.git

Step2: Pull the Docker image which is based on Python + PyQt. You can refer to its Dockerfile.
$ docker pull tzutalin/py2qt4
Step3: Get started with the application and container
docker run -it \
--user $(id -u) \
-e DISPLAY=unix$DISPLAY \
--workdir=$(pwd) \
--volume="/home/$USER:/home/$USER" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
tzutalin/py2qt4
Then, you will see that we can run GUI inside the container.

If you want to get more detailed information, you can check out the following video.

6 comments:

  1. After trying to do

    python labelImg.py

    I got a message 'Cannot connect to X server unixlocalhost:12.0'

    How can I solve this ?

    ReplyDelete
    Replies
    1. I think that you tried to connect via ssh.

      Delete
  2. Wifi Password Hacker you container demonstration your networks that Wifi Key hacker is a request that aid you slave watchword of a wifi system. Hack Wifi Password Online

    ReplyDelete
  3. Download Wickr Me – Private Messenger Mod APK files and Original APK file. ... Accelerated up to 200% with dFast Torrent Cloud™ Enjoy the fastest download .Wickr Me 5.104.14 Crack

    ReplyDelete