一、sudo yum install dockerpython
二、安裝以後服務並不會自動啓動:
systemctl status docker.servicelinux
[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
三、啓動服務
sudo systemctl start docker.servicesql
四、獲取CentOS image
sudo docker pull centos:6.8
完整版本列表見:https://hub.docker.com/_/centos/docker
五、建立本身的 image
sudo docker commit axxxxxxxxxxb flying/pgsql-develcentos
六、運行
sudo docker run -ti flying/pgsql-develapi
至此,剩下的步驟跟普通Linux沒什麼區別,過程當中遇到的惟一問題是不使用sudo會報「docker: Cannot connect to the Docker daemon.」bash
七、編譯參數(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 perlapp
補充:ssh
一、傳遞文件至容器有點麻煩,見《使用docker,不要用ssh鏈接到你的container 》
http://snoopyxdy.blog.163.com/blog/static/601174402014720113318508/
官方關於這個問題應該是持支持態度:
https://docs.docker.com/engine/examples/running_ssh_service/oop
個人辦法是在容器裏邊安裝 openssh-clients,而後從host拷貝文件過來。
二、發現命令 cp,這應該纔是文件拷貝的正確途徑 只是對於交互式編譯來講,彷佛不是很是適用