IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Docker:MineCraft【我的世界】_搭建本地服务器,并连入玩耍

    Adamhuan发表于 2016-10-23 11:32:44
    love 0

    MineCraft,我的世界,是一款很不错的沙盒游戏。
    利用Docker,你可以在本地搭建自己的服务器。

    下面会有两种方式安装:
    1. Kitematic,图形化界面
    2. 命令行

    下面开始。
    ————————————————————————
    一、服务器端:
    【Install By Kitematic】
    docker_minecraft_1

    启动:
    docker_minecraft_2

    【命令行】
    安装:

    [root@dockerme ~]# docker run -t -i -d -p 25565:25565 \
    > -v /var/run/docker.sock:/var/run/docker.sock \
    > --name dockercraft \
    > gaetan/dockercraft
    Unable to find image 'gaetan/dockercraft:latest' locally
    latest: Pulling from gaetan/dockercraft
    6a5a5368e0c2: Pull complete 
    7b9457ec39de: Pull complete 
    ff18e19c2db4: Pull complete 
    6c16e36b7fbf: Pull complete 
    dac6749e202c: Pull complete 
    80302b4e1d83: Pull complete 
    2fefc8a47308: Pull complete 
    f683132d5492: Pull complete 
    5c59a0cbd941: Pull complete 
    5bf0a71b87a5: Pull complete 
    d6e30ad4cf7b: Pull complete 
    b610addcbeba: Pull complete 
    eec2e60a021c: Pull complete 
    b4eb4b2189c3: Pull complete 
    5395ab3c839e: Pull complete 
    67f574cac1f3: Pull complete 
    Digest: sha256:fe7f5df498061aa9cf286950911c238b2b8ba8ef12a2a4cfd702ef469cb1156b
    Status: Downloaded newer image for gaetan/dockercraft:latest
    5d907a1d67dfd852f03703f463bcd746a004218678c7886024c4d2347d79045d
    [root@dockerme ~]#

    安装后检查:

    [root@dockerme ~]# ps -ef | grep --color docker
    root      12096      1  0 Oct22 ?        00:03:21 /usr/bin/dockerd
    root      12102  12096  0 Oct22 ?        00:00:02 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc
    root      44554  12102  0 Oct22 ?        00:00:00 docker-containerd-shim 4b45a030749a426bbc39aa4dca425d6752c07c48195f2270ec53696722b1110e /var/run/docker/libcontainerd/4b45a030749a426bbc39aa4dca425d6752c07c48195f2270ec53696722b1110e docker-runc
    root      64980  12096  0 04:03 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 25565 -container-ip 172.17.0.2 -container-port 25565
    root      64994  12102  0 04:03 ?        00:00:00 docker-containerd-shim 5d907a1d67dfd852f03703f463bcd746a004218678c7886024c4d2347d79045d /var/run/docker/libcontainerd/5d907a1d67dfd852f03703f463bcd746a004218678c7886024c4d2347d79045d docker-runc
    root      65020  65007 85 04:03 pts/4    00:12:00 dockercraft
    root      65623  16435  0 04:17 pts/2    00:00:00 grep --color=auto --color docker
    [root@dockerme ~]# 
    [root@dockerme ~]# ps -ef | grep --color craft
    root      65020  65007 85 04:03 pts/4    00:12:08 dockercraft
    root      65625  16435  0 04:17 pts/2    00:00:00 grep --color=auto --color craft
    [root@dockerme ~]# 
    [root@dockerme ~]# netstat -tupln | grep --color docker
    tcp6       0      0 :::25565                :::*                    LISTEN      64980/docker-proxy  
    [root@dockerme ~]#

    ————————————————————————
    二、客户端:
    客户端下载:
    1. http://bbs.3dmgame.com/thread-5279868-1-1.html
    2. http://bbs.3dmgame.com/thread-4419897-1-1.html

    启动客户端:
    mc_client_1

    mc_client_2

    mc_client_3

    mc_client_4

    选择【直接连接】
    mc_client_5
    写入你的Docker服务器的IP:192.168.111.143
    以及MineCraft的端口:25565

    就可以连入你自己的MineCraft服务端了。

    进入【我的世界】后,你看到的画面:
    mc_client_6

    上图中,我们看到了几个方块状的小房间。
    走近看,你会发现,每个房间的门牌上标注的就是之前在Docker中创建的容器:
    mc_client_7

    mc_client_8

    至此,在Linux本地使用Docker搭建Mine Craft的服务器,并连接玩耍,就完了。
    ——————————————————————
    Done。



沪ICP备19023445号-2号
友情链接