无法连接到Postfix 3.3.1 Docker容器

时间:2018-10-05 21:23:49

标签: docker dockerfile

我正在尝试为后缀3.3建立一个容器。容器可以正常构建和运行,但是我无法连接到它。

Dockerfile:

    #Postfix 3.3 container
    #This container uses a version of postfix considered not yet ready for production
    #by the package provider.  Use at your own risk.

    FROM centos:7
    LABEL maintainer="Chad Cordero (ccordero@csusb.edu)"

    #Add Ghettoforge repo
    RUN curl -o /tmp/gf-release-latest.gf.el7.noarch.rpm http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
    RUN rpm -i /tmp/gf-release-latest.gf.el7.noarch.rpm

    #Remove postfix2
    RUN yum remove -y postfix

    # Install postfix opendkim saslauthd
    RUN yum install -y --enablerepo=gf-testing postfix3

    # Latest updates
    RUN yum update -y

    # Clean up
    RUN yum clean all

    #Required by postfix start-fg
    RUN postconf inet_protocols="ipv4"

    # Expose smtp and submission
    EXPOSE 25

    CMD ["postfix","start-fg"]

构建容器不会出错。

$ docker build . -t chadcordero/postfix3
Sending build context to Docker daemon  241.2kB Step 1/11 : FROM centos:7  ---> 5182e96772bf Step 2/11 : LABEL maintainer="Chad Cordero (ccordero@csusb.edu)"  ---> Running in 4abce1f5e3b5 Removing intermediate container 4abce1f5e3b5  ---> eea11df8266e Step 3/11 : RUN curl -o /tmp/gf-release-latest.gf.el7.noarch.rpm http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
---> Running in 1a502135c839   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed 100  8036  100  8036    0     0  78999      0 --:--:-- --:--:--
--:--:-- 79564 Removing intermediate container 1a502135c839  ---> c6515d1f6e7d Step 4/11 : RUN rpm -i /tmp/gf-release-latest.gf.el7.noarch.rpm  ---> Running in d3daa3f25493 warning: /tmp/gf-release-latest.gf.el7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID da8b7718: NOKEY Removing intermediate container d3daa3f25493  ---> c20b7895b85b Step 5/11 : RUN yum remove -y postfix 
---> Running in 36188dd28049 Loaded plugins: fastestmirror, ovl No Match for argument: postfix No Packages marked for removal Removing intermediate container 36188dd28049  ---> ba0d8c6eb5e4 Step 6/11 : RUN yum install -y --enablerepo=gf-testing postfix3  ---> Running in 7adddaac9d74 Loaded plugins: fastestmirror, ovl Determining fastest mirrors  * base: mirror.scalabledns.com  * extras: mirror.scalabledns.com  * updates: mirror.scalabledns.com Resolving Dependencies
--> Running transaction check
---> Package postfix3.x86_64 2:3.3.1-1.gf.el7 will be installed
--> Processing Dependency: /sbin/service for package: 2:postfix3-3.3.1-1.gf.el7.x86_64
--> Processing Dependency: libicuuc.so.50()(64bit) for package: 2:postfix3-3.3.1-1.gf.el7.x86_64
--> Processing Dependency: libicui18n.so.50()(64bit) for package: 2:postfix3-3.3.1-1.gf.el7.x86_64
--> Processing Dependency: libicudata.so.50()(64bit) for package: 2:postfix3-3.3.1-1.gf.el7.x86_64
--> Running transaction check
---> Package initscripts.x86_64 0:9.49.41-1.el7_5.2 will be installed
--> Processing Dependency: sysvinit-tools >= 2.87-5 for package: initscripts-9.49.41-1.el7_5.2.x86_64
--> Processing Dependency: iproute for package: initscripts-9.49.41-1.el7_5.2.x86_64
---> Package libicu.x86_64 0:50.1.2-15.el7 will be installed
--> Running transaction check
---> Package iproute.x86_64 0:4.11.0-14.el7 will be installed
--> Processing Dependency: libmnl.so.0(LIBMNL_1.0)(64bit) for package: iproute-4.11.0-14.el7.x86_64
--> Processing Dependency: libxtables.so.10()(64bit) for package: iproute-4.11.0-14.el7.x86_64
--> Processing Dependency: libmnl.so.0()(64bit) for package: iproute-4.11.0-14.el7.x86_64
---> Package sysvinit-tools.x86_64 0:2.88-14.dsf.el7 will be installed
--> Running transaction check
---> Package iptables.x86_64 0:1.4.21-24.1.el7_5 will be installed
--> Processing Dependency: libnfnetlink.so.0()(64bit) for package: iptables-1.4.21-24.1.el7_5.x86_64
--> Processing Dependency: libnetfilter_conntrack.so.3()(64bit) for package: iptables-1.4.21-24.1.el7_5.x86_64
---> Package libmnl.x86_64 0:1.0.3-7.el7 will be installed
--> Running transaction check
---> Package libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3 will be installed
---> Package libnfnetlink.x86_64 0:1.0.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================  Package                   Arch      Version                Repository  Size
================================================================================ Installing:  postfix3                  x86_64    2:3.3.1-1.gf.el7      gf-testing    3.0 M Installing for dependencies:  initscripts          x86_64    9.49.41-1.el7_5.2      updates       437 k  iproute          x86_64    4.11.0-14.el7          base          763 k  iptables         x86_64    1.4.21-24.1.el7_5      updates       432 k  libicu           x86_64    50.1.2-15.el7          base          6.9 M  libmnl           x86_64    1.0.3-7.el7            base           23 k  libnetfilter_conntrack    x86_64    1.0.6-1.el7_3          base        55 k  libnfnetlink              x86_64    1.0.1-4.el7            base  26 k  sysvinit-tools            x86_64    2.88-14.dsf.el7        base  63 k

Transaction Summary
================================================================================ Install  1 Package (+8 Dependent packages)

Total download size: 12 M Installed size: 39 M Downloading packages: warning: /var/cache/yum/x86_64/7/updates/packages/initscripts-9.49.41-1.el7_5.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Public key for initscripts-9.49.41-1.el7_5.2.x86_64.rpm is not installed Public key for libmnl-1.0.3-7.el7.x86_64.rpm is not installed warning: /var/cache/yum/x86_64/7/gf-testing/packages/postfix3-3.3.1-1.gf.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID da8b7718: NOKEY Public key for postfix3-3.3.1-1.gf.el7.x86_64.rpm is not installed
-------------------------------------------------------------------------------- Total                                               13 MB/s |  12 MB  00:00      Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Importing GPG key 0xF4A80EB5:  Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"  Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5  Package    : centos-release-7-5.1804.1.el7.centos.x86_64 (@Updates)  From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 Importing GPG key 0xDA8B7718:  Userid     : "Ghettoforge (el7) <gf@ghettoforge.org>"  Fingerprint: b43e a892 86f4 b6fd ff83 fed1 d005 ae31 da8b 7718  Package    : gf-release-7-10.gf.el7.noarch (installed)  From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum.   Installing : libmnl-1.0.3-7.el7.x86_64                                    1/9    Installing : libnfnetlink-1.0.1-4.el7.x86_64                           2/9    Installing : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64        3/9    Installing : iptables-1.4.21-24.1.el7_5.x86_64                  4/9    Installing : iproute-4.11.0-14.el7.x86_64                       5/9    Installing : sysvinit-tools-2.88-14.dsf.el7.x86_64              6/9    Installing : initscripts-9.49.41-1.el7_5.2.x86_64               7/9    Installing : libicu-50.1.2-15.el7.x86_64                        8/9    Installing : 2:postfix3-3.3.1-1.gf.el7.x86_64                   9/9    Verifying  : libnfnetlink-1.0.1-4.el7.x86_64                    1/9    Verifying  : libmnl-1.0.3-7.el7.x86_64                          2/9    Verifying  : initscripts-9.49.41-1.el7_5.2.x86_64               3/9    Verifying  : libicu-50.1.2-15.el7.x86_64                        4/9    Verifying  : iptables-1.4.21-24.1.el7_5.x86_64                  5/9    Verifying  : 2:postfix3-3.3.1-1.gf.el7.x86_64                   6/9    Verifying  : sysvinit-tools-2.88-14.dsf.el7.x86_64              7/9    Verifying  : iproute-4.11.0-14.el7.x86_64                       8/9    Verifying  : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64        9/9 

Installed:   postfix3.x86_64 2:3.3.1-1.gf.el7                         


Dependency Installed:   initscripts.x86_64 0:9.49.41-1.el7_5.2         iproute.x86_64 0:4.11.0-14.el7                                         iptables.x86_64 0:1.4.21-24.1.el7_5                                    libicu.x86_64 0:50.1.2-15.el7                                          libmnl.x86_64 0:1.0.3-7.el7                                            libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3                          libnfnetlink.x86_64 0:1.0.1-4.el7                                      sysvinit-tools.x86_64 0:2.88-14.dsf.el7                               


Complete! Removing intermediate container 7adddaac9d74  ---> 51f250cd5ba2 Step 7/11 : RUN yum update -y  ---> Running in 1741f6cdec56 Loaded plugins: fastestmirror, ovl Loading mirror speeds from cached hostfile  * base: mirror.scalabledns.com  * extras: mirror.scalabledns.com  * updates: mirror.scalabledns.com Resolving Dependencies
--> Running transaction check
---> Package audit-libs.x86_64 0:2.8.1-3.el7 will be updated
---> Package audit-libs.x86_64 0:2.8.1-3.el7_5.1 will be an update
---> Package bind-license.noarch 32:9.9.4-61.el7 will be updated
---> Package bind-license.noarch 32:9.9.4-61.el7_5.1 will be an update
---> Package centos-release.x86_64 0:7-5.1804.1.el7.centos will be updated
---> Package centos-release.x86_64 0:7-5.1804.4.el7.centos will be an update
---> Package dracut.x86_64 0:033-535.el7 will be updated
---> Package dracut.x86_64 0:033-535.el7_5.1 will be an update
---> Package kpartx.x86_64 0:0.4.9-119.el7 will be updated
---> Package kpartx.x86_64 0:0.4.9-119.el7_5.1 will be an update
---> Package libblkid.x86_64 0:2.23.2-52.el7 will be updated
---> Package libblkid.x86_64 0:2.23.2-52.el7_5.1 will be an update
---> Package libmount.x86_64 0:2.23.2-52.el7 will be updated
---> Package libmount.x86_64 0:2.23.2-52.el7_5.1 will be an update
---> Package libuuid.x86_64 0:2.23.2-52.el7 will be updated
---> Package libuuid.x86_64 0:2.23.2-52.el7_5.1 will be an update
---> Package nss.x86_64 0:3.36.0-5.el7_5 will be updated
---> Package nss.x86_64 0:3.36.0-7.el7_5 will be an update
---> Package nss-sysinit.x86_64 0:3.36.0-5.el7_5 will be updated
---> Package nss-sysinit.x86_64 0:3.36.0-7.el7_5 will be an update
---> Package nss-tools.x86_64 0:3.36.0-5.el7_5 will be updated
---> Package nss-tools.x86_64 0:3.36.0-7.el7_5 will be an update
---> Package systemd.x86_64 0:219-57.el7 will be updated
---> Package systemd.x86_64 0:219-57.el7_5.3 will be an update
---> Package systemd-libs.x86_64 0:219-57.el7 will be updated
---> Package systemd-libs.x86_64 0:219-57.el7_5.3 will be an update
---> Package util-linux.x86_64 0:2.23.2-52.el7 will be updated
---> Package util-linux.x86_64 0:2.23.2-52.el7_5.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================  Package             Arch        Version                     Repository Size
================================================================================ Updating:  audit-libs          x86_64      2.8.1-3.el7_5.1             updates       99 k  bind-license        noarch      32:9.9.4-61.el7_5.1         updates       85 k  centos-release      x86_64      7-5.1804.4.el7.centos       updates       25 k  dracut     x86_64      033-535.el7_5.1             updates      325 k  kpartx     x86_64      0.4.9-119.el7_5.1           updates       76 k  libblkid   x86_64      2.23.2-52.el7_5.1           updates      178 k  libmount   x86_64      2.23.2-52.el7_5.1           updates      180 k  libuuid    x86_64      2.23.2-52.el7_5.1           updates       81 k  nss        x86_64      3.36.0-7.el7_5              updates      835 k  nss-sysinit         x86_64      3.36.0-7.el7_5              updates    62 k  nss-tools           x86_64      3.36.0-7.el7_5              updates      515 k  systemd             x86_64      219-57.el7_5.3     updates      5.0 M  systemd-libs        x86_64      219-57.el7_5.3     updates      402 k  util-linux          x86_64      2.23.2-52.el7_5.1  updates      2.0 M

Transaction Summary
================================================================================ Upgrade  14 Packages

Total download size: 9.8 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
-------------------------------------------------------------------------------- Total                                               19 MB/s | 9.8 MB  00:00      Running transaction check Running transaction test Transaction test succeeded Running transaction   Updating   : libuuid-2.23.2-52.el7_5.1.x86_64                            1/28    Updating   : libblkid-2.23.2-52.el7_5.1.x86_64                         2/28    Updating   : libmount-2.23.2-52.el7_5.1.x86_64                 3/28    Updating   : nss-sysinit-3.36.0-7.el7_5.x86_64                 4/28    Updating   : nss-3.36.0-7.el7_5.x86_64                         5/28    Updating   : systemd-libs-219-57.el7_5.3.x86_64                6/28    Updating   : audit-libs-2.8.1-3.el7_5.1.x86_64                 7/28    Updating   : util-linux-2.23.2-52.el7_5.1.x86_64               8/28    Updating   : centos-release-7-5.1804.4.el7.centos.x86_64       9/28    Updating   : systemd-219-57.el7_5.3.x86_64                     10/28  Failed to get D-Bus connection: Operation not permitted   Updating   : kpartx-0.4.9-119.el7_5.1.x86_64                           11/28    Updating   : dracut-033-535.el7_5.1.x86_64                    12/28    Updating   : nss-tools-3.36.0-7.el7_5.x86_64                  13/28    Updating   : 32:bind-license-9.9.4-61.el7_5.1.noarch          14/28    Cleanup    : 32:bind-license-9.9.4-61.el7.noarch              15/28    Cleanup    : dracut-033-535.el7.x86_64                        16/28    Cleanup    : systemd-219-57.el7.x86_64                        17/28    Cleanup    : util-linux-2.23.2-52.el7.x86_64                  18/28    Cleanup    : libmount-2.23.2-52.el7.x86_64                    19/28    Cleanup    : libblkid-2.23.2-52.el7.x86_64                    20/28    Cleanup    : nss-tools-3.36.0-5.el7_5.x86_64                  21/28    Cleanup    : centos-release-7-5.1804.1.el7.centos.x86_64      22/28    Cleanup    : nss-sysinit-3.36.0-5.el7_5.x86_64                23/28    Cleanup    : nss-3.36.0-5.el7_5.x86_64                        24/28    Cleanup    : libuuid-2.23.2-52.el7.x86_64                     25/28    Cleanup    : audit-libs-2.8.1-3.el7.x86_64                    26/28    Cleanup    : systemd-libs-219-57.el7.x86_64                   27/28    Cleanup    : kpartx-0.4.9-119.el7.x86_64                      28/28    Verifying  : nss-3.36.0-7.el7_5.x86_64                        1/28    Verifying  : kpartx-0.4.9-119.el7_5.1.x86_64                   2/28    Verifying  : libmount-2.23.2-52.el7_5.1.x86_64                 3/28    Verifying  : centos-release-7-5.1804.4.el7.centos.x86_64       4/28    Verifying  : 32:bind-license-9.9.4-61.el7_5.1.noarch           5/28    Verifying  : libuuid-2.23.2-52.el7_5.1.x86_64                  6/28    Verifying  : audit-libs-2.8.1-3.el7_5.1.x86_64                 7/28    Verifying  : systemd-219-57.el7_5.3.x86_64                     8/28    Verifying  : systemd-libs-219-57.el7_5.3.x86_64                9/28    Verifying  : dracut-033-535.el7_5.1.x86_64                     10/28    Verifying  : nss-sysinit-3.36.0-7.el7_5.x86_64                11/28    Verifying  : libblkid-2.23.2-52.el7_5.1.x86_64                12/28    Verifying  : nss-tools-3.36.0-7.el7_5.x86_64                  13/28    Verifying  : util-linux-2.23.2-52.el7_5.1.x86_64              14/28    Verifying  : libmount-2.23.2-52.el7.x86_64                    15/28    Verifying  : nss-tools-3.36.0-5.el7_5.x86_64                  16/28    Verifying  : audit-libs-2.8.1-3.el7.x86_64                    17/28    Verifying  : libblkid-2.23.2-52.el7.x86_64                    18/28    Verifying  : kpartx-0.4.9-119.el7.x86_64                      19/28    Verifying  : nss-sysinit-3.36.0-5.el7_5.x86_64                20/28    Verifying  : systemd-libs-219-57.el7.x86_64                   21/28    Verifying  : dracut-033-535.el7.x86_64                        22/28    Verifying  : util-linux-2.23.2-52.el7.x86_64                  23/28    Verifying  : systemd-219-57.el7.x86_64                        24/28    Verifying  : 32:bind-license-9.9.4-61.el7.noarch              25/28    Verifying  : centos-release-7-5.1804.1.el7.centos.x86_64      26/28    Verifying  : nss-3.36.0-5.el7_5.x86_64                        27/28    Verifying  : libuuid-2.23.2-52.el7.x86_64                     28/28 

Updated:   audit-libs.x86_64 0:2.8.1-3.el7_5.1                         bind-license.noarch 32:9.9.4-61.el7_5.1                                centos-release.x86_64 0:7-5.1804.4.el7.centos                          dracut.x86_64 0:033-535.el7_5.1                                        kpartx.x86_64 0:0.4.9-119.el7_5.1                                      libblkid.x86_64 0:2.23.2-52.el7_5.1                                    libmount.x86_64 0:2.23.2-52.el7_5.1                                    libuuid.x86_64 0:2.23.2-52.el7_5.1                                     nss.x86_64 0:3.36.0-7.el7_5                                            nss-sysinit.x86_64 0:3.36.0-7.el7_5                                    nss-tools.x86_64 0:3.36.0-7.el7_5                                      systemd.x86_64 0:219-57.el7_5.3                                        systemd-libs.x86_64 0:219-57.el7_5.3                                   util-linux.x86_64 0:2.23.2-52.el7_5.1                                 


Complete! Removing intermediate container 1741f6cdec56  ---> 79474d207116 Step 8/11 : RUN yum clean all  ---> Running in d36149efe71c Loaded plugins: fastestmirror, ovl Cleaning repos: base extras gf updates Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos Cleaning up list of fastest mirrors Removing intermediate container d36149efe71c  ---> 0f5c253306f3 Step 9/11 : RUN postconf inet_protocols="ipv4"  ---> Running in 4a8e76907a2f Removing intermediate container 4a8e76907a2f  ---> deb434e4fdf6 Step 10/11 : EXPOSE 25  ---> Running in ecb40ae67267 Removing intermediate container ecb40ae67267  ---> 8ea7ac3c4d56 Step 11/11 : CMD ["postfix","start-fg"]  ---> Running in af621bcb1493 Removing intermediate container af621bcb1493  ---> cd40901a02fe Successfully built cd40901a02fe Successfully tagged chadcordero/postfix3:latest

容器似乎正常运行。

$ docker run --rm -it -p 2525:25 chadcordero/postfix3
postfix/postfix-script: starting the Postfix mail system

但是,我无法连接到端口。

$ telnet 192.168.99.100 2525
Trying 192.168.99.100...
telnet: connect to address 192.168.99.100: Connection refused
telnet: Unable to connect to remote host

我正在MacOS 10.13.6上测试运行Docker 18.06.1-ce-mac73(26764)的容器。

0 个答案:

没有答案