Giter Club home page Giter Club logo

dockercraft's Introduction

dockercraft

simple docker container for a minecraft server

This is based heavily on https://github.com/itzg/dockerfiles (I didn't want to fork the entire repo which contains many different dockerfiles)

The data-only container is simple, but was intially based on:
https://registry.hub.docker.com/u/aduermael/minecraft-data/

Starting from scratch:
clone this repo

Prep the server image (this part is kinda clunky and should be generalized one day. see the issues)

$ cd mcserver  

edit the following variables in start-minecraft.sh (one day this should be an external file)

gamename='monster'  #shortname 
url="http://www.creeperrepo.net/FTB2/modpacks%5EMonster%5E1_1_1%5EMonsterServer.zip"  #point to whichever server.zip you want to play
rawzip="modpacks^Monster^1_1_1^MonsterServer.zip"  #could use regex and ${url} to automatically set
jarfile="FTBServer-1.6.4-965.jar"  #the jar file to run from within the zip.

Build the images:

$ cd mcserver

$ docker build -t jmbjr/mcserver-monster .

$ cd ../mcdata

$ docker build -t jmbjr/mcdata

view your images with:

$ docker images

Run the containers:
need to run the data container first:

$ docker run -d -it --name mcdata-mon jmbjr/mcdata  
-d      run daemonized
-it     allow $ docker attach mcdata-mon
--name  name the container for easy access later

run the server container and point to the data container:

$ docker run -e EULA=TRUE -d -it -p 25565:25565 --name mcserver-mon --volumes-from mcdata-mon jmbjr/mcserver-monster
-e              set environemnt variable to accept the mojang EULA (see mcserver/README.md for more info)
-d              run daemonized
-it             allow $ docker attach mcserver-mon
-p              connect to port external:internal (or whatever port you want to run the server on. internal port set in Dockerfile)
--name          name the container for easy access later
--volumes-from  point to our data-only mcdata container

view running containers via:

$ docker ps

view ALL containers, regardless of running or not via:

$ docker ps -a

view log file from a container (useful when docker ps doesn't show your container running)

$ docker logs <container --name> 

attach to the container (to view the minecraft server console or to view the mc data)

$ docker attach <container --name>

use ctrl+p ctrl+q to detach

to start and stop the container:

$ docker start <container --name>

$ docker stop  <container --name>

to remove/delete containers:

$ docker rm <container --name>

to remove/delete images

$ docker rmi <image --name>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.