docker run -itd -v /data/:/data1 centos bash // -v 用来指定挂载目录, :前面的/data为本地目录,:后面的/data1 为容器里的目录: docker:/root# docker run -itd --name zjtest8_frontend -v /data/zjtest8/frontend/:/var/www 192.168.32.150:5000/zjzc_centos6.5_m3 bash e7ddb534ff695fe520e057a960e340b585658878096cbbc59562f582e4531f8f docker:/root# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e7ddb534ff69 192.168.32.150:5000/zjzc_centos6.5_m3 "bash" 3 seconds ago Up 1 seconds zjtest8_frontend bc9914f15b3b 192.168.32.150:5000/zjzc_centos6.5_m3 "bash" 52 minutes ago Up 42 minutes zjtest8_haproxy docker:/root# docker exec -it e7ddb534ff69 bash 把宿主机的/data/zjtest8/frontend/ 映射到容器的/var/www 目录 bash-4.1# df -h Filesystem Size Used Avail Use% Mounted on rootfs 9.8G 1.5G 7.8G 17% / /dev/mapper/docker-253:0-131547-e7ddb534ff695fe520e057a960e340b585658878096cbbc59562f582e4531f8f 9.8G 1.5G 7.8G 17% / tmpfs 3.9G 0 3.9G 0% /dev shm 64M 0 64M 0% /dev/shm /dev/mapper/vg00-lv_root 490G 4.9G 461G 2% /var/ww