Sr. Sorawit
Sep 29, 2018 · 2 min read

การใช้ Docker GUI บน OS X

docker on Mac

Problem mapping port in Mac

เนื่องจากโครงสร้าง หรือ Infrastructure ไม่เหมือนกันทำให้ใช้วิธีการ mapping ไม่เหมือนกัน

Infrastructure of Linux and OS X

สำหรับ check path ที่เชื่อมต่อ docker กับ เครื่องของเรา

Click Preferences -> File Sharing

Step 1: Install brew

เพื่อนำไปติดตั้ง application อื่นๆ ด้วย Terminal บน OS X

https://brew.sh

Step 2 : Install socat and xquartz

In Terminal

brew install socat
brew cask install xquartz
open -a XQuartz
App : XQuartz

Checked : Allow connections from network clients

Click Preferences -> Security

Step 3: Set port for display

In Terminal

xhost + 127.0.0.1
export DISPLAY=docker.for.mac.localhost:0
echo $DISPLAY
Example in terminal

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
Example in terminal

Step 4: Create file and Run file “ex1.py”

In Terminal

import numpy as np
import cv2
path_image = '/workdir/DOLAB/Medium/Blog/logo-dolab.png'
img =cv2.imread(path_image)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Example in terminal test run {}.py

DOLAB

Education for Software Engineering and We make dreams through this.

Sr. Sorawit

Written by

Data Experience @Guru Square • Software Engineer • From @Thailand • founder dolab • Website:http://dolab.cc/ Email:dolab.founder@gmail.com • Facebook:dolab

DOLAB

DOLAB

Education for Software Engineering and We make dreams through this.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade