Run GUI application on Docker container

Purpose

Build an environment where you can run GUI applications such as text editors on Docker.

The following will be explained in another article. --Enables Japanese input --Introduce a text editor (VSCode)

The following is not described. --Introduce docker, docker-compose

Add settings to Ubuntu Docker image

For the future, create a Docker image that allows you to: --bash-complete works effectively --A standard folder structure such as Download is created in the home folder when adding a user.

Dockerfile


FROM ubuntu

# ***********************************************
# install packages for xrdp, and do setting
# ***********************************************
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        apt-utils sudo curl bash-completion 

# ***********************************************
# setting skelton
# ***********************************************
RUN mkdir -p /etc/skel/Desktop \
    /etc/skel/Downloads \
    /etc/skel/Templates \
    /etc/skel/Public \
    /etc/skel/Documents \
    /etc/skel/Music \
    /etc/skel/Pictures \
    /etc/skel/Videos

# ***********************************************
# bash complete 
# ***********************************************
RUN mv /etc/apt/sources.list /etc/apt/sources.list.d/sources.list

# `apt-cache --no-generate ` can not work. I don't know why.
# so, apt-cache remove option "--no-generate"
RUN sed "s/--no-generate //g" /usr/share/bash-completion/completions/apt >/tmp/apt
RUN mv /tmp/apt /usr/share/bash-completion/completions/apt


RUN { \
        echo "# enable programmable completion features (you don't need to enable"; \
        echo "# this, if it's already enabled in /etc/bash.bashrc and /etc/profile"; \
        echo "# sources /etc/bash.bashrc)."; \
        echo "if ! shopt -oq posix; then"; \
        echo "  if [ -f /usr/share/bash-completion/bash_completion ]; then"; \
        echo "    . /usr/share/bash-completion/bash_completion"; \
        echo "  elif [ -f /etc/bash_completion ]; then"; \
        echo "    . /etc/bash_completion"; \
        echo "  fi"; \
        echo "fi"; \
        echo ""; \
    } >> /root/.bashrc

Build container image


sudo docker build ./ -t sabocla6/ubuntu_base 

Set the container image name as you like. However, since the container image will be created based on this container image in the following description, Change the base of that Dockerfile.

Creating an executable container image for GUI applications

Dockerfile


FROM sabocla6/ubuntu_base

# ***********************************************
# install packages for xrdp, and do setting
# ***********************************************
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        zenity x11-apps

# ***********************************************
# setting keyboard layout
# ***********************************************
RUN { \
      echo 'XKBMODEL="pc105"'; \
      echo 'XKBLAYOUT="jp""'; \
      echo 'XKBVARIANT=""'; \
      echo 'XKBOPTIONS=""'; \
      echo ''; \
      echo 'BACKSPACE="guess"'; \
    } > /etc/default/keyboard

Build container image


sudo docker build ./ -t sabocla6/ubuntu_ui 

Set the container image name as you like.

Related article

Run VS Code on Docker Run GUI application on Docker container (Japanese input)

Recommended Posts

Run GUI application on Docker container
Run GUI application on Docker container (Japanese input)
Run React on a Docker container
Run PureScript on a Docker container
Run NordVPN on Docker (Windows) Ubuntu container
Run phpunit on Docker
Run VS Code on Docker
Run openvpn on Docker (windows)
Run the Android emulator on Docker using Android Emulator Container Scripts
Display ROS application on Docker with GUI on host side
Run SSE (Server-Sent-Event) samples on docker
Run puppeteer-core on Heroku (Docker edition)
Run the AWS CLI on Docker
How to run JavaFX on Docker
Time is wrong with the application launched on the Docker container
Launch docker container on EC2 (personal memorandum)
Run Embulk on Docker to convert files
Until you run apache on ubuntu on docker
Run Ubuntu + ROS with Docker on Mac
Liberty on Docker
Small Docker container
Redmine on Docker
Run JSP Hello World with Tomcat on Docker
I made a Docker container to run Maven
Send emails using Docker container on Raspberry Pi 3
Run an application made with Go on Heroku
Update container image with KUSANAGI Runs on Docker
I tried running Ansible on a Docker container
Run STS4 on Mac
Docker installation on CentOS 6
Lambda on Terraform Container
python notes on docker
Test run on rails
Run Pico with docker
Run PostgreSQL on Java
Install Docker on Manjaro
GitHub Actions/Cache: Cache bundle installed gems on Docker container
Run Payara with Docker
[Docker] Build an Apache container on EC2 using dockerfile
Docker container usage scene
Run Processing on Ant
Run tiscamera on Ubuntu 18.04
M.S. docker on Windows
Docker installation on WSL2
Proceed with Rust official documentation on Docker container (1. Getting started)
Until you run Quarkus and run docker image on Amazon ECS
Run lilypond on Docker on macOS Catalina to create sheet music
I tried running a Docker container on AWS IoT Greengrass 2.0
Try Hello World using plain Java on a Docker container
What is docker run -it?
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO
Run TAO Core with Docker
Install Docker on Ubuntu Server 20.04
Try Docker on Windows 10 Home
Run chromium-mir-kiosk on Ubuntu Core
Run Rails whenever with docker
Decomposing the Docker run command. .. ..
Run java applet on ubuntu
CI / CD Docker container monitoring
Hosted Apicurio Studio on Docker