1、sudo yum install docker
2、安装之后服务并不会自动启动:
systemctl status docker.service
[quanzl@postgresdata applications]$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: http://docs.docker.com
3、启动服务
sudo systemctl start docker.service
4、获取CentOS image
sudo docker pull centos:6.8
完整版本列表见:https://hub.docker.com/_/centos/
5、创建自己的 image
sudo docker commit axxxxxxxxxxb flying/pgsql-devel
6、运行
sudo docker run -ti flying/pgsql-devel
至此,剩下的步骤跟普通Linux没什么区别,过程中遇到的唯一问题是不使用sudo会报“docker: Cannot connect to the Docker daemon.”
7、编译参数(Docker中运行)
我自己常用的:./configure --prefix=/opt/PostgreSQL/9.6b4 --without-ldap --with-openssl --without-perl --without-python --without-tcl --without-pam --enable-thread-safety --with-libxml --without-ossp-uuid --with-libxslt --without-selinux --with-libedit-preferred --without-gssapi --disable-rpath
上述参数需要如下包支持(可能仍不完整):
yum install gcc flex bison openssl-devel zlib-devel libedit-devel libxml2-devel libxslt-devel perl
补充:
1、传递文件至容器有点麻烦,见《使用docker,不要用ssh连接到你的container 》
http://snoopyxdy.blog.163.com/blog/static/601174402014720113318508/
官方关于这个问题应该是持支持态度:
https://docs.docker.com/engine/examples/running_ssh_service/
我的办法是在容器里边安装 openssh-clients,然后从host拷贝文件过来。
2、发现命令 cp,这应该才是文件拷贝的正确途径
只是对于交互式编译来说,似乎不是非常适用