Skip to content

Instantly share code, notes, and snippets.

@J-Rios
Last active April 10, 2023 10:28
Show Gist options
  • Save J-Rios/e4e6575624af2068c8927541213c5cd1 to your computer and use it in GitHub Desktop.
Save J-Rios/e4e6575624af2068c8927541213c5cd1 to your computer and use it in GitHub Desktop.
Setup LinuxDeployQT in a Docker container. Instructions on how to prepare a Docker Container to use linuxdeployqt from an Ubuntu 18.04 host system through a Ubuntu 14.04 Docker container.

Setup LinuxDeployQT in a Docker container

  1. Install Docker:
wget https://raw.githubusercontent.com/J-Rios/BASH-Scripts/master/install/install_docker
sudo chmod +x install_docker
sudo ./install_docker
  1. Get Ubuntu 14.04 Docker base image:
sudo docker pull ubuntu:trusty
  1. Launch a container of the downloaded Ubuntu image:
sudo docker run -d --name dockerdeployqt -it ubuntu:trusty
  1. Enter the Container and get all required elements:
sudo docker exec -it dockerdeployqt bash
cd /root
apt-get update
apt-get -y install wget
apt-get -y install libglib2.0-0
  1. Install QT5:
wget https://raw.githubusercontent.com/J-Rios/BASH-Scripts/master/install/install_qt5
chmod +x install_qt5
./install_qt5
rm -f ./install_qt5
  1. Get and setup linuxdeployqt tool:
wget https://github.com/probonopd/linuxdeployqt/releases/download/6/linuxdeployqt-6-x86_64.AppImage
chmod +x linuxdeployqt-6-x86_64.AppImage
./linuxdeployqt-6-x86_64.AppImage --appimage-extract
mv squashfs-root deployqt
ln -s /root/deployqt/AppRun /usr/local/sbin/linuxdeployqt
rm -f linuxdeployqt-6-x86_64.AppImage
  1. Check that linuxdeployqt is working:
linuxdeployqt
  1. Exit the Container ad stop it (everything is ready to be used):
exit
sudo docker stop dockerdeployqt
@ratijas
Copy link

ratijas commented Jun 17, 2020

I have created a Dockerfile based on these instructions: https://gist.github.com/ratijas/f62ac36768d72d3a925ebfe114b0cd15

@ratijas
Copy link

ratijas commented Jun 17, 2020

Qt is very ancient on ubuntu:trusty. Need to find a way to install latest 5.15.

@thebigG
Copy link

thebigG commented Jun 17, 2020

I actually had solved the problem. But thanks so much for the docker file!

@akskumar31
Copy link

@thebigG I am having same problem, could you share the solution please. I am using Qt 5.15.

@thebigG
Copy link

thebigG commented Jul 6, 2020

Hi there @askumar31! I ended up not using linuxdeployqt. I used this-->https://github.com/AppImageCrafters/appimage-builder
I highly suggest you use it too; it is a very intuitive/easy-to-use implementation of AppImageKit.
They have a great tutorial right here-->https://appimage-builder.readthedocs.io/en/latest/intro/tutorial.html#what-s-next

I highly suggest taking your time and reading the tutorial--it helped me a ton!

I also wrote a script for my own project that makes building the AppImage a little easier if you are familiar with Qt's build system(qmake): https://github.com/thebigG/Tasker/blob/main/Tasker/build_AppImage.py

Hopefully you can get in there and change a few variables and use it for your own purposes!

Note that appimage-builder has support for testing on docker containers(you can easily test ALL linux distros with just a few command) and all of that good stuff!

I also highly recommend joining the IRC chat on here https://webchat.freenode.net/#AppImage

A lot of people(including me) hang out there a lot and are always willing to help!

Hopefully you find this somewhat helpful.
Cheers!

@Simran-B
Copy link

In case you want to run an AppImage in a Docker container where FUSE doesn't work unless you run it with --privileged (dangerous),
try the --appimage-extract-and-run option:

linuxdeployqt-continuous-x86_64.AppImage *.desktop -appimage --appimage-extract-and-run

Works on my end and is easier than to manually extract and run the deploy tool.

@GogoLike
Copy link

Create Dockerfile with Ubuntu 18.04

FROM ubuntu:18.04

RUN apt-get update && apt-get install -y
wget
qt5-default
gcc
g++
cmake

RUN wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
&& chmod +x linuxdeployqt-*
&& ./linuxdeployqt-* --appimage-extract
&& mv squashfs-root deployqt
&& ln -s /deployqt/AppRun /usr/local/sbin/linuxdeployqt
&& rm -f linuxdeployqt-*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment