Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rodando aplicações de interface gráfica com Docker

Diego Leite
December 15, 2018

Rodando aplicações de interface gráfica com Docker

Diego Leite

December 15, 2018
Tweet

More Decks by Diego Leite

Other Decks in Programming

Transcript

  1. • Introdução ao problema • Apple App SandBox • Como

    o Docker funciona? • What the heck is X11? • Como o Docker X11 socket share funciona? • Talk is cheap. Show me the code! • Por quê fazer isso? • Como controlar a quantidade de memória que o chrome come da sua máquina? • Demo ROTEIRO @di3goleite
  2. INTRODUÇÃO AO PROBLEMA @di3goleite • cmake • ffmpeg • qtbase5-dev

    • libswscale-dev • libavcodec-dev • libboost-all-dev • libavformat-dev • opencv
  3. APPLE APP SANDBOX App Sandbox enables you to describe how

    your app interacts with the system. The system then grants your app the access it needs to get its job done, and no more. @di3goleite
  4. X11 - WINDOW SYSTEM @di3goleite • Originalmente chamado simplesmente de

    X • Desenvolvido no MIT em 1984 • Atualmente está na versão 11 • É o toolkit e protocolo padrão para GUI nos sistemas Unix e Linux
  5. COMO FAZER PARA IMPLEMENTAR ISSO? @di3goleite For a GUI Application

    to run, we need to have a XServer which is available as part of every Linux Desktop Environment, But within a Container we don’t have any XServer — so we will. • share the Host’s XServer with the Container by creating a volume --volume="$HOME/.Xauthority:/root/.Xauthority:rw" • share the Host’s DISPLAY environment variable to the Container --env="DISPLAY" • run container with host network driver with --net=host
  6. COMO FAZER PARA IMPLEMENTAR ISSO? @di3goleite $ cat Dockerfile FROM

    centos RUN yum install -y xeyes CMD ["/usr/bin/xeyes"] $ sudo docker build -t gui-app . $ sudo docker run --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" gui-app
  7. @di3goleite $ docker run -it \ --net host \ #

    may as well YOLO --cpuset-cpus 0 \ # control the cpu --memory 512mb \ # max memory it can use -v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket -e DISPLAY=unix$DISPLAY \ # pass the display -v $HOME/Downloads:/root/Downloads \ # optional, but nice -v $HOME/.config/google-chrome/:/data \ # if you want to save state --device /dev/snd \ # so we have sound --name chrome \ jess/chrome COMO CONTROLAR A QUANTIDADE DE MEMÓRIA QUE O CHROME COME DA SUA MÁQUINA?