This repository based on the basic boot2docker repository, and referenced with Windows environment.
- Go back to commit
c7e5c3
- Annotated
rm -rf ./*/kernel/drivers/media/* && \
at Dockerfile #L86 - Changed libcap2 url at Dockerfile #L95
- Added conditions at kernel_config like below:
#
# Additional Configuration
#
# Processor type and features
#
CONFIG_FRAME_VECTOR=y
#
# Generic Driver Options
#
CONFIG_DMA_SHARED_BUFFER=y
#
# Multifunction device drivers
#
CONFIG_MEDIA_SUPPORT=m
#
# Multimedia core support
#
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_VIDEO_DEV=m
CONFIG_VIDEO_V4L2=m
CONFIG_VIDEOBUF2_CORE=m
CONFIG_VIDEOBUF2_MEMOPS=m
CONFIG_VIDEOBUF2_VMALLOC=m
#
# Media drivers
#
CONFIG_MEDIA_USB_SUPPORT=y
#
# Webcam devices
#
CONFIG_USB_VIDEO_CLASS=m
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
CONFIG_USB_GSPCA=m
CONFIG_USB_S2255=m
#
# Webcam, TV (analog/digital) USB devices
#
CONFIG_V4L_PLATFORM_DRIVERS=y
#
# Media ancillary drivers (tuners, sensors, i2c, frontends)
#
CONFIG_MEDIA_SUBDRV_AUTOSELECT=y
#
# USB Physical Layer drivers
#
CONFIG_USB_GADGET=m
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
#
# USB Peripheral Controller
#
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_F_MASS_STORAGE=m
CONFIG_USB_F_UVC=m
CONFIG_USB_CONFIGFS=m
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_UVC=y
#
# Pseudo filesystems
#
CONFIG_CONFIGFS_FS=m
-
Install:
brew install socat
-
Install:
brew install xquartz
-
Run:
open -a XQuartz
-
Setting: XQuartz Preferences -> Security -> check allow all (Allow connections from network clients)
-
Run:
defaults write org.macosforge.xquartz.X11 enable_iglx -bool true
-
Run:
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
-
Run:
xhost + $IP
-
Install VirtualBox and its Extension pack
-
Create new docker-machine environment using VirtualBox like below:
docker-machine create -d virtualbox \ --virtualbox-cpu-count=2 \ --virtualbox-memory=2048 \ --virtualbox-disk-size=100000 \ --virtualbox-boot2docker-url https://github.com/gzupark/boot2docker-webcam-mac/releases/download/18.06.1-ce-usb/boot2docker.iso \ ${YOUR_DOCKER_MACHINE_ENV_NAME}
-
Run:
docker-machine stop ${YOUR_DOCKER_MACHINE_ENV_NAME}
-
Configure the VirtualBox image that you created
- Display -> Video memory (max)
- Display -> Acceleration -> Enable 3D acceleration (check)
- Ports -> USB -> Enable USB controller (check) -> USB 2.0 (select)
- Shared folders -> Add -> Folder Path set root path = / or Folder name you want
- To run below steps everytime when you want to use webcams with docker
- Assume normal terminal session is T1, and XQuartz terminal or 2nd terminal session is T2
- Run T1:
open -a XQuartz
- Run T2:
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
- if it occurs an error, please check with
lsof -i tcp:6000
andkill
the PID
- if it occurs an error, please check with
- Run T1:
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
- Run T1:
xhost + $IP
- Run T1:
docker-machine start ${YOUR_DOCKER_MACHINE_ENV_NAME}
- Run T1:
eval $(docker-machine env ${YOUR_DOCKER_MACHINE_ENV_NAME})
- Run T1:
vboxmanage list webcams
and check a list - Run T1:
vboxmanage controlvm "${YOUR_DOCKER_MACHINE_ENV_NAME}" webcam attach .1
or others referenced a list
-
xeyes
docker run --rm -it -e DISPLAY=$IP:0 gns3/xeyes
-
firefox
docker run --rm -it -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
docker run --rm -it --device=/dev/video0:/dev/video0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$IP:0 \
${YOUR_DOCKER_IMAGE}