Containerizer
Docker可以透過一些方式來讓docker內的程序也可以操作docker跑在host上,這種方式稱為Docker的Containerizer,該方式是透過掛載docker的sock file與command來達到操作的目的,指令如下:
docker run -it \
-v /run/docker.sock:/run/docker.sock \
-v /usr/bin/docker:/bin/docker \
debian bash
Debug...如果您看到這樣的結果:
docker: error while loading shared libraries: libapparmor.so.1: cannot open shared object file: No such file or directory
在debian中可以透過安裝libapparmor-dev來補足需要的套件
# apt-get update -y && apt-get install libapparmor-dev -y
然後就可以透過docker指令來操作:
root@1b1cf8612272:/# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b1cf8612272 containerizer "bash" 2 seconds ago Up 2 seconds awesome_albattani
bb4666bd9354 nginx "nginx -g 'daemon off" 22 hours ago Up 22 hours 80/tcp, 443/tcp condescending_varahamihira