Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Qt in Windows Docker container

    Installation and Deployment
    5
    11
    8772
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      Felix Maurer last edited by

      Hi,

      I'm developing a Qt application on Windows. Currently I'm trying to automate the build process.
      I wanted to try using Docker containrs, to have a reliable build environment. However, I'm stuck at creating an image that contains a Qt installation. I have a Windows image that contains the msvc2017 toolchain but I don't know how to install Qt into the image in a non-interactive fashion.

      Is there a way to install Qt on Windows without a graphical installer? I tried the offline installer and a script but was unsuccessful.

      Regards
      Felix

      U 1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        What script are you using ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • F
          Felix Maurer last edited by Felix Maurer

          I used the script I found on StackOverflow and tried to modify it based on the documentation and the commets in this bug report.

          function Controller() {
              //gui.setSilent(true);
          	
              //installer.autoRejectMessageBoxes();
              installer.installationFinished.connect(function() {
                  gui.clickButton(buttons.NextButton);
              })
          }
          
          Controller.prototype.WelcomePageCallback = function() {
              gui.clickButton(buttons.NextButton);
          }
          
          Controller.prototype.IntroductionPageCallback = function() {
              gui.clickButton(buttons.NextButton);
          }
          
          Controller.prototype.CredentialsPageCallback = function() {
              gui.clickButton(buttons.SkipButton);
          }
          
          Controller.prototype.TargetDirectoryPageCallback = function()
          {
              gui.currentPageWidget().TargetDirectoryLineEdit.setText("C:/Qt");
              gui.clickButton(buttons.NextButton);
          }
          
          Controller.prototype.ComponentSelectionPageCallback = function() {
              var widget = gui.currentPageWidget();
          
              widget.deselectAll();
          	widget.selectComponent("qt.595.win64_msvc2017_64");
          	widget.selectComponent("qt.595.qtcharts.win64_msvc2017_64");
          	
              gui.clickButton(buttons.NextButton);
          }
          
          Controller.prototype.LicenseAgreementPageCallback = function() {
              gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
              gui.clickButton(buttons.NextButton);
          }
          
          Controller.prototype.StartMenuDirectoryPageCallback = function() {
              gui.clickButton(buttons.NextButton);
          }
          
          Controller.prototype.ReadyForInstallationPageCallback = function()
          {
              gui.clickButton(buttons.NextButton);
          }
          
          Controller.prototype.FinishedPageCallback = function() {
          	var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm
          	if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
          		checkBoxForm.launchQtCreatorCheckBox.checked = false;
          	}
              gui.clickButton(buttons.FinishButton);
          }
          

          The installer opens but nothing happens. Furthermore, I can click buttons but only jump between the first two pages of the installer.

          I called the installer like this C:\Users\mrf\qt-opensource-windows-x86-5.9.5.exe --verbose --script .\qt-noninteractive.qs.

          1 Reply Last reply Reply Quote 0
          • U
            user2301 @Felix Maurer last edited by

            @Felix-Maurer Hi, were you able to create QT docker container?

            1 Reply Last reply Reply Quote 0
            • U
              user2301 last edited by user2301

              I also tried but no luck. Below is the dockerfile and qt-installer-non-interactive.qs.
              I get this Network error: [ QNetworkReply::NetworkError(UnknownNetworkError) ] "Failed to connect to server. Check your network connection and try again."

              function Controller() {
                  installer.autoRejectMessageBoxes();
                  installer.installationFinished.connect(function() {
                      gui.clickButton(buttons.NextButton);
                  })
              }
              
              Controller.prototype.WelcomePageCallback = function() {
                  gui.clickButton(buttons.NextButton, 3000);
              }
              
              Controller.prototype.CredentialsPageCallback = function() {
                  gui.clickButton(buttons.NextButton);
              }
              
              Controller.prototype.IntroductionPageCallback = function() {
                  gui.clickButton(buttons.NextButton);
              }
              
              Controller.prototype.TargetDirectoryPageCallback = function()
              {
                  gui.currentPageWidget().TargetDirectoryLineEdit.setText("C:\\Qt");
                  gui.clickButton(buttons.NextButton);
              }
              
              Controller.prototype.ComponentSelectionPageCallback = function() {
                  var widget = gui.currentPageWidget();
              
                  widget.deselectAll();
                  //widget.selectComponent("qt.55.gcc_64");
                  //widget.selectComponent("qt.55.qtquickcontrols");
              
                  widget.selectComponent("qt.tools.qtcreator");
                  widget.selectComponent("qt.tools.vcredist_msvc2015_x64");
                  widget.selectComponent("qt.qt5.5101.win64_msvc2015_64");
                  widget.deselectComponent("qt.tools.vcredist_msvc2015_x86");
                  //widget.deselectComponent("qt.55.qtquick1");
                  //widget.deselectComponent("qt.55.qtscript");
                  //widget.deselectComponent("qt.55.qtwebengine");
                  //widget.deselectComponent("qt.extras");
                  widget.deselectComponent("qt.qt5.5101.doc");
                  widget.deselectComponent("qt.qt5.5101.examples");
              
                  gui.clickButton(buttons.NextButton);
              }
              
              Controller.prototype.LicenseAgreementPageCallback = function() {
                  gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
                  gui.clickButton(buttons.NextButton);
              }
              
              Controller.prototype.StartMenuDirectoryPageCallback = function() {
                  gui.clickButton(buttons.NextButton);
              }
              
              Controller.prototype.ReadyForInstallationPageCallback = function()
              {
                  gui.clickButton(buttons.NextButton);
              }
              
              Controller.prototype.FinishedPageCallback = function() {
              var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm
              if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
                  checkBoxForm.launchQtCreatorCheckBox.checked = false;
              }
                  gui.clickButton(buttons.FinishButton);
              }
              
              FROM microsoft/windowsservercore:10.0.14393.2189
              
              COPY ["./install", "C:/tmp/qt"]
              
              RUN ["C:\\tmp\\qt\\qt-opensource-windows-x86-5.10.1.exe", "--script C:\\tmp\\qt\\qt-installer-noninteractive.qs"]
              
              ENV PATH "$PATH:C:\Qt\Qt5.10.1"
              
              ENV PATH "$PATH:C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC"
              
              CMD ["vcvarsall.bat", "x86_amd64"]
              
              1 Reply Last reply Reply Quote 0
              • F
                Felix Maurer last edited by

                I haven't retried it yet but will again in some days.

                1 Reply Last reply Reply Quote 0
                • M
                  mkalinow last edited by

                  Hi,

                  this is the Docker setup we use to create QBS builds. Maybe that can be of help even though this is made for Linux.

                  http://code.qt.io/cgit/qbs/qbs.git/tree/docker/stretch/Dockerfile

                  1 Reply Last reply Reply Quote 2
                  • M
                    mkalinow last edited by

                    And here it is for Windows:
                    http://code.qt.io/cgit/qbs/qbs.git/tree/docker/windowsservercore/Dockerfile

                    U 1 Reply Last reply Reply Quote 2
                    • F
                      Felix Maurer last edited by

                      Very cool thanks! That did work for me. Now I just have to adjust it to our needs.

                      Pablo J. Rogina 1 Reply Last reply Reply Quote 1
                      • Pablo J. Rogina
                        Pablo J. Rogina @Felix Maurer last edited by

                        @Felix-Maurer if your issue is solved, please don't forget to mark your post as such. Thanks.

                        Upvote the answer(s) that helped you solve the issue
                        Use "Topic Tools" button to mark your post as Solved
                        Add screenshots via postimage.org
                        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                        1 Reply Last reply Reply Quote 0
                        • U
                          user2301 @mkalinow last edited by

                          @mkalinow I tried the above script but it did not work due to network issues. Is it possible to create docker build without connecting to internet or download offline?

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post