[root@localhost software]# docker run -it -d -p 9995:8080 -v /usr/local/software/tomcat_p_9995/:/usr/local/tomcat/webapps --privileged=true tomcat:8.5 1f53c5b786b9a57843e5fa714afb7d7b8151614b5c2f602029c14d1a229a417a [root@localhost software]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1f53c5b786b9 tomcat:8.5 "catalina.sh run" About a minute ago Up About a minute 0.0.0.0:9995->8080/tcp hardcore_volhard [root@localhost software]#
Options: --build-arg list Set build-time variables (default []) --cache-from stringSlice Images to consider as cache sources --cgroup-parent string Optional parent cgroup for the container --compress Compress the build context using gzip --cpu-period int Limit the CPU CFS (Completely Fair Scheduler) period --cpu-quota int Limit the CPU CFS (Completely Fair Scheduler) quota -c, --cpu-shares int CPU shares (relative weight) --cpuset-cpus string CPUs in which to allow execution (0-3, 0,1) --cpuset-mems string MEMs in which to allow execution (0-3, 0,1) --disable-content-trust Skip image verification (default true) -f, --file string Name of the Dockerfile (Default is 'PATH/Dockerfile') --force-rm Always remove intermediate containers --help Print usage --isolation string Container isolation technology --label list Set metadata for an image (default []) -m, --memory string Memory limit --memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap --network string Set the networking mode for the RUN instructions during build (default "default") --no-cache Do not use cache when building the image --pull Always attempt to pull a newer version of the image -q, --quiet Suppress the build output and print image ID on success --rm Remove intermediate containers after a successful build (default true) --security-opt stringSlice Security options --shm-size string Size of /dev/shm, default value is 64MB -t, --tag list Name and optionally a tag in the 'name:tag' format (default []) --ulimit ulimit Ulimit options (default []) -v, --volume list Set build-time bind mounts (default [])
[root@localhost docker]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 00bc4c3a9b49 mycentos01:1.0 "/bin/bash" 4 seconds ago Up 3 seconds centos3 43dabcee22ec mycentos01:1.0 "/bin/bash" About a minute ago Up About a minute centos2 4a0a0d288acf mycentos01:1.0 "/bin/bash" 4 minutes ago Up 4 minutes centos1
测试方法
进入centos1,在mydata里面创建个centos1.txt
1 2 3 4 5
[root@localhost docker]# docker exec -it centos1 /bin/bash [root@4a0a0d288acf mydata]# touch centos1.txt [root@4a0a0d288acf mydata]# echo "make file in centos1" > centos1.txt [root@4a0a0d288acf mydata]# cat centos1.txt make file in centos1