Blog #2 : Docker GUI on OS X
Published in
2 min readSep 29, 2018
การใช้ Docker GUI บน OS X
Problem mapping port in Mac
เนื่องจากโครงสร้าง หรือ Infrastructure ไม่เหมือนกันทำให้ใช้วิธีการ mapping ไม่เหมือนกัน
สำหรับ check path ที่เชื่อมต่อ docker กับ เครื่องของเรา
Step 1: Install brew
เพื่อนำไปติดตั้ง application อื่นๆ ด้วย Terminal บน OS X
Step 2 : Install socat and xquartz
In Terminal
brew install socat
brew cask install xquartz
open -a XQuartz
Checked : Allow connections from network clients
Step 3: Set port for display
In Terminal
xhost + 127.0.0.1
export DISPLAY=docker.for.mac.localhost:0
echo $DISPLAY
Step 4: Run docker
In Terminal
docker run -it -p 8850:8888 \
-p 6650:6006 \
-p 5000:4000 \
-v $(pwd):/workdir \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
tf-py3-dockerfile \
bash
Step 4: Create file and Run file “ex1.py”
In Terminal
import numpy as np
import cv2path_image = '/workdir/DOLAB/Medium/Blog/logo-dolab.png'
img =cv2.imread(path_image)cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()