Skip to content

Instantly share code, notes, and snippets.

Docker Container GUI Display
https://leimao.github.io/blog/Docker-Container-GUI-Display/
Introduction
Docker is typically used for containerized application and development. However, people hardly used it for applications that have GUIs.
It turns out that Docker is fully capable of running GUI applications. In this blog post, I would like to discuss how to run GUI applications from Docker quickly using two simple examples.
Examples
The key to run GUI applications from Docker image is to set -e DISPLAY=$DISPLAY and -v /tmp/.X11-unix:/tmp/.X11-unix for Docker container. Also make sure that the X clients can be connected from any host, including our Docker container, by running xhost +.
openssl genrsa -out privkey.pem 2048
openssl rsa -in privkey.pem -out key.pem
openssl req -sha256 -new -key key.pem -out cert.csr -subj '/CN=localhost'
openssl x509 -req -sha256 -days 365 -in cert.csr -signkey key.pem -out cert.crt
cat cert.crt key.pem > fullchain.pem
@eshnil2000
eshnil2000 / MyClass.java
Created September 2, 2022 03:51
get by className
package newpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;
//import org.openqa.selenium.firefox.FirefoxDriver;
//comment the above line and uncomment below line to use Chrome
import org.openqa.selenium.chrome.ChromeDriver;
public class MyClass {
@eshnil2000
eshnil2000 / MyClass.java
Created September 1, 2022 22:02
selenium findElementbyID
package newpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;
//import org.openqa.selenium.firefox.FirefoxDriver;
//comment the above line and uncomment below line to use Chrome
import org.openqa.selenium.chrome.ChromeDriver;
public class MyClass {
@eshnil2000
eshnil2000 / convert-to-transparent.gif
Created November 29, 2021 09:06 — forked from uxder/convert-to-transparent.gif
nft-alpha-transparency-gif-maker.sh
## A script to make a series of pngs that uses alpha transparency into an animated gif.
## Gifs only support 100% transparent or a 100% opaque pixel colors so imagemagick will convert your 80% transparent color into 100%.
## Requires: Imagemagick
# Make all transparency into white pixels.
mogrify -background white -alpha remove *.png
# Convert the white pixels back to transparency.
for f in *.png
do
@eshnil2000
eshnil2000 / docker-swarm-ports.md
Created February 4, 2021 05:03 — forked from BretFisher/docker-swarm-ports.md
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example

################################################################
# API and dashboard configuration
################################################################
api:
# Dashboard
#
#
dashboard: true
insecure: true
################################################################
version: '3'
services:
traefik:
# The latest official supported Traefik docker image
image: traefik:v2.3
# Enables the Traefik Dashboard and tells Traefik to listen to docker
# enable --log.level=INFO so we can see what Traefik is doing in the log files
ports:
# Exposes port 80 for incomming web requests
#docker build -t ndc .
#docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v /home/nick/docker-browser2:/tmp --privileged ndc
#https://tutorials.releaseworksacademy.com/learn/the-simple-way-to-run-docker-in-docker-for-ci
FROM node:latest
WORKDIR /usr/src/app
COPY test.js /usr/src/app
RUN apt update && apt install nano
RUN npm install --save-dev composefile
FROM node:latest
WORKDIR /usr/src/app
COPY test.js /usr/src/app
RUN apt update && apt install nano
RUN npm install --save-dev composefile
RUN npm install --save-dev docker-compose
const composefile = require('composefile');
const dockercompose = require('docker-compose');