OSx Docker IPAddress为空

时间:2017-08-02 10:27:25

标签: docker docker-toolbox

我正在研究OSx(sierra),Docker(docker toolbox)。这是我第一次使用Docker。 我已经设置了apache容器。当我启动此容器时,它会在日志中返回以下错误。 (但容器正在运行。)

  

httpd:无法可靠地确定服务器的完全限定   域名,使用127.0.0.2。设置' ServerName'全球指令   取消此消息

这是我的docker-compose.yml

apache:
  build:
    context: .
    dockerfile: ./Dockerfile
  volumes:
    - ./htdocs/:/var/www/vhosts/middlewarep.xyz/htdocs/
    - ./zend.conf:/etc/httpd/conf.d/zend.conf
  networks:
    widgets:
      ipv4_address: 172.15.1.7
  ports:
    - 89:80

如果我运行以下命令

MDTPLT0583:~ sam$ docker ps -a
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                        PORTS               NAMES
7dd2372dea7d        middlewaredocker_apache   "/apache/start.sh"       18 hours ago        Up 35 minutes                                     middlewaredocker_apache_1
9ceadf6d2574        panubo/vsftpd             "/entry.sh vsftpd"       19 hours ago        Exited (143) 11 minutes ago                       middlewaredocker_ftp_1
c27c0d7fd66a        0bd4809a04a1              "docker-entrypoint..."   21 hours ago        Exited (0) 12 minutes ago                         middlewaredocker_mongodb_1
MDTPLT0583:~ sam$ docker inspect 7dd2372dea7d | grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "",
                    "IPAddress": "",

问题:

  1. 没有分配IP地址。它是否正确?如果不是我如何配置它或我做错了什么?

  2. 我试图配置ftp docker(panubo / vsftpd)容器和ftp 从middleware_apache_1到ftp容器的文件。

    curl -T data/input/my-try-file.txt ftp://172.15.1.21 --user miduser:midpaswd
    
  3. 但这会让我回复curl: (7) Failed to connect to 172.15.1.21: Network is unreachable

    以下是ftp容器的docker-composer.yml中的部分:

    ftp:
      image: panubo/vsftpd
      env_file: docker-env/ftp.env
      networks:
        widgets:
          ipv4_address: 172.15.1.21
      ports:
        - "21:21"
      volumes:
        - ./htdocs/data/ftp:/var/www/vhosts/middlewarep.xyz/htdocs/data/ftp/
    

    [root@b6782a36a049 /]# ip a show的输出:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
    2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN qlen 1
        link/ipip 0.0.0.0 brd 0.0.0.0
    3: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN qlen 1
        link/gre 0.0.0.0 brd 0.0.0.0
    4: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN qlen 1000
        link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    5: ip_vti0@NONE: <NOARP> mtu 1332 qdisc noop state DOWN qlen 1
        link/ipip 0.0.0.0 brd 0.0.0.0
    6: ip6_vti0@NONE: <NOARP> mtu 1500 qdisc noop state DOWN qlen 1
        link/tunnel6 :: brd ::
    7: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN qlen 1
        link/sit 0.0.0.0 brd 0.0.0.0
    8: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN qlen 1
        link/tunnel6 :: brd ::
    9: ip6gre0@NONE: <NOARP> mtu 1448 qdisc noop state DOWN qlen 1
        link/[823] 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 brd 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
    

0 个答案:

没有答案