1)写dockerfile (参考网上教程)
FROM centos:latest RUN mkdir /usr/netflow WORKDIR /usr/netflow COPY ./ . COPY lib/install_lib.sh /usr/bin/install_lib.sh RUN chmod +x /usr/bin/install_lib.sh CMD ["install_lib.sh"] COPY env_config.sh /usr/bin/env_config.sh RUN chmod +x /usr/bin/env_config.sh CMD ["env_config.sh"] COPY collect/start.sh /usr/bin/start.sh RUN chmod +x /usr/bin/start.sh CMD ["start.sh"]
2)制作容器命令
docker build -t 容器名称:标签 工作目录
eg:
docker build -t netflow:v1.0 .
3)执行程序,并启动容器程序执行脚本
docker run -i -t --privileged --net=host -v /var/lib/mysql:/var/lib/mysql -v /datadb/netflowData:/datadb/netflowData netflow_ens33_x86_64:v1.0 /bin/sh start.sh
4)查看程序是否在运行