Docker GUI与Mac如何

时间:2015-02-03 14:27:38

标签: macos user-interface docker

我最近从docker开始,我在设置现有的docker-desktop图像时遇到问题,并且在我的屏幕上显示t。 这将是个性化整个图像的第一步:

我遵循了几个网站的指示,但最简单的是以下内容: dockerfile/ubuntu-desktop

  • 下载图片没问题
  • 当我运行它时,我获得以下输出:

    $ docker run -it --rm -p 5901:5901 -e USER=root dockerfile/ubuntu-desktop     bash -c "vncserver :1 -geometry 1280x800 -depth 24 && tail -F /root/.vnc/*.log"
    You will require a password to access your desktops.
    Password: 
    Verify:   
    Would you like to enter a view-only password (y/n)? n
    New 'X' desktop is 0792f104dfd0:1
    Creating default startup script /root/.vnc/xstartup
    Starting applications specified in /root/.vnc/xstartup
    Log file is /root/.vnc/0792f104dfd0:1.log
    03/02/15 14:10:08 Copyright (C) 2000-2007 TightVNC Group
    03/02/15 14:10:08 Copyright (C) 1999 AT&T Laboratories Cambridge
    03/02/15 14:10:08 All Rights Reserved.
    03/02/15 14:10:08 See http://www.tightvnc.com/ for information on TightVNC
    03/02/15 14:10:08 Desktop name 'X' (0792f104dfd0:1)
    03/02/15 14:10:08 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
    03/02/15 14:10:08 Listening for VNC connections on TCP port 5901
    Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring
    Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
    Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring
    xrdb: No such file or directory
    xrdb: can't open file '/root/.Xresources'
    AUDIT: Tue Feb  3 14:10:09 2015: 17 Xtightvnc: client 6 rejected from local host
    

容器检查输出如下:

    $ docker inspect -f '{{json .NetworkSettings }}' 0792f104dfd0 
    {"Bridge":"docker0","Gateway":"172.17.42.1",
    "IPAddress":"172.17.0.21","IPPrefixLen":16,
    "MacAddress":"02:42:ac:11:00:15",
    "PortMapping":null,
    "Ports":{"5901/tcp":[{"HostIp":"0.0.0.0","HostPort":"5901"}]}}

当我尝试连接VCN时,我收到错误。

你可以帮我找到我应该改变的东西,使用Docker在mac上运行一个可见的桌面吗?

1 个答案:

答案 0 :(得分:2)

如果您只是缺少.Xresources文件,请尝试在那里添加一个空文件。 This discussion似乎暗示它并非真正需要。您可以使用以下方法添加文件:

docker run -it --rm -p 5901:5901 -e USER=root dockerfile/ubuntu-desktop \
    bash -c "touch /root/.Xresources && \
    vncserver :1 -geometry 1280x800 -depth 24 && \ 
    tail -F /root/.vnc/*.log"

OSX上的Docker(以及任何非Linux操作系统)在boot2docker vm内运行,并且该VM的网络在VM外部的localhost上不可用。要访问网络接口,请使用可以使用boot2docker ip命令检索的Boot2docker IP。此IP通常为192.168.59.103,但不保证。