├── .dockerignore ├── .gitignore ├── docker-compose.yml ├── Dockerfile └── README.md /.dockerignore: -------------------------------------------------------------------------------- 1 | /UnrealEngine.* 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /UnrealEngine 2 | /UnrealEngine.bk 3 | /UnrealEngine.* 4 | NVIDIA-Linux-x86_64-340.76.run 5 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | ue4: 2 | image: ue4:master 3 | devices: 4 | - "/dev/nvidia0" 5 | - "/dev/nvidiactl" 6 | - "/dev/snd/timer" 7 | - "/dev/snd/seq" 8 | - "/dev/snd/hwC0D0" 9 | - "/dev/snd/controlC0" 10 | - "/dev/snd/hwC1D3" 11 | - "/dev/snd/hwC0D1" 12 | - "/dev/snd/hwC1D2" 13 | - "/dev/snd/hwC1D1" 14 | - "/dev/snd/hwC1D0" 15 | - "/dev/snd/controlC1" 16 | - "/dev/snd/pcmC1D7p" 17 | - "/dev/snd/pcmC1D8p" 18 | - "/dev/snd/pcmC1D9p" 19 | - "/dev/snd/pcmC1D3p" 20 | - "/dev/snd/pcmC0D0p" 21 | - "/dev/snd/pcmC0D0c" 22 | environment: 23 | DISPLAY: ":0.0" 24 | net: "host" 25 | volumes: 26 | - /tmp/.X11-unix:/tmp/.X11-unix:ro 27 | # - /proc:/proc:rw 28 | privileged: true 29 | command: /bin/bash 30 | #so that it does not consume the whole host machine 31 | cpu_shares: 812 32 | user: unreal 33 | # dockerfile: Dockerfile-alternate 34 | # ue4: 35 | # image: ue4:4.8.2-codelite 36 | # devices: 37 | # - "/dev/nvidiactl" 38 | # - "/dev/snd/timer" 39 | # - "/dev/snd/seq" 40 | # - "/dev/snd/hwC0D0" 41 | # - "/dev/snd/controlC0" 42 | # - "/dev/snd/hwC1D3" 43 | # - "/dev/snd/hwC0D1" 44 | # - "/dev/snd/hwC1D2" 45 | # - "/dev/snd/hwC1D1" 46 | # - "/dev/snd/hwC1D0" 47 | # - "/dev/snd/controlC1" 48 | # - "/dev/snd/pcmC1D7p" 49 | # - "/dev/snd/pcmC1D8p" 50 | # - "/dev/snd/pcmC1D9p" 51 | # - "/dev/snd/pcmC1D3p" 52 | # - "/dev/snd/pcmC0D0p" 53 | # - "/dev/snd/pcmC0D0c" 54 | # environment: 55 | # DISPLAY: ":0.0" 56 | # net: "host" 57 | # volumes: 58 | # - /tmp/.X11-unix:/tmp/.X11-unix:ro 59 | # # - /proc:/proc:rw 60 | # privileged: true 61 | # command: /bin/bash 62 | # cpu_shares: 812 63 | # # dockerfile: Dockerfile-alternate 64 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04.2 2 | 3 | MAINTAINER joee liew liewjoee@yahoo.com 4 | 5 | #Add display driver 6 | #ADD NVIDIA-Linux-x86_64-340.76.run /tmp/NVIDIA-DRIVER.run 7 | RUN apt-get update && apt-get install -yq kmod mesa-utils software-properties-common 8 | 9 | #ADD codelite 10 | RUN apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc 11 | RUN apt-add-repository 'deb http://repos.codelite.org/ubuntu/ trusty universe' 12 | 13 | #ADD mesa driver 14 | RUN apt-add-repository ppa:oibaf/graphics-drivers 15 | 16 | #ADD open source nvidia driver 17 | RUN add-apt-repository ppa:xorg-edgers/ppa 18 | 19 | RUN apt-get update 20 | 21 | RUN apt-get install -yq build-essential mono-gmcs mono-xbuild mono-dmcs \ 22 | libmono-corlib4.0-cil libmono-system-data-datasetextensions4.0-cil \ 23 | libmono-system-web-extensions4.0-cil libmono-system-management4.0-cil \ 24 | libmono-system-xml-linq4.0-cil cmake dos2unix clang-3.5 libfreetype6-dev \ 25 | libgtk-3-dev libmono-microsoft-build-tasks-v4.0-4.0-cil \ 26 | xdg-user-dirs pulseaudio alsa-utils \ 27 | x11-apps libclang-common-3.5-dev libclang1-3.5 libllvm3.5 llvm-3.5 \ 28 | llvm-3.5-dev llvm-3.5-runtime libgtk-3-0 git codelite wxcrafter 29 | 30 | #Dont install all the recommended, will blow up the package 31 | RUN apt-get install -yq --no-install-recommends nvidia-340 32 | 33 | #why the libdbus gone screwy 34 | RUN apt-get -yq install libdbus-1-3 libdbus-1-dev 35 | #had manually soft link the library 36 | RUN ln -s /lib/x86_64-linux-gnu/libdbus-1.so.3.7.6 /lib/x86_64-linux-gnu/libdbus-1.so 37 | 38 | #thin up the whole images 39 | RUN apt-get autoremove 40 | RUN apt-get autoclean 41 | 42 | Add UnrealEngine /UnrealEngine 43 | 44 | #Add user `unreal` 45 | RUN useradd -ms /bin/bash unreal 46 | RUN adduser unreal sudo 47 | #RUN ./Setup.sh --> this is run on the host to safe time on the docker build and rebuild in case you need to add dependecies 48 | WORKDIR /UnrealEngine 49 | RUN ./GenerateProjectFiles.sh 50 | 51 | #change the directory to the unreal user 52 | RUN chown -R unreal:unreal /UnrealEngine 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ue4-in-docker 2 | 3 | ## Why do you have to run in Docker 4 | This is the recording of what you have done to get in working for you. 5 | I can experiment with the container(if I am unsure) without comprising what I want to preserved. 6 | 7 | On the contrary, you could also share the your dockerbuild to verify the dependencies is properly installed 8 | 9 | If I move to a new host which I am about too, because laptop sucks, then I dont have to worry about whole process of setup 10 | 11 | ##How to run in your desktop 12 | ### ubuntu ( I am using xubuntu 14:04) -feel free to contribute others 13 | 14 | #### Preparation before docker build 15 | 1) clone the my repo to your local disk 16 | ```` 17 | git clone https://github.com/tweakmy/ue4-in-docker.git 18 | $cd ue4-in-docker 19 | ```` 20 | 21 | 2) clone the unreal engine within the folder, it will prompt for your github password 22 | ```` 23 | $git clone https://github.com/EpicGames/UnrealEngine.git 24 | $cd UnrealEngine 25 | ```` 26 | 3) Run Setup.sh here to save time trying to download the Unreal Editor Dependencies (this would be the content,docu,sample,tutorial) during the docker build 27 | ```` 28 | $sudo apt-get install mono libmono-microsoft-build-tasks-v4.0-4.0-cil 29 | $./Setup.sh 30 | ```` 31 | **This is very time consuming as well 32 | 33 | 4) Modify the `RUN apt-get install -yq --no-install-recommends nvidia-340` in the Dockefile and put the correct NVIDIA driver version in there. 34 | **Dont know how best to automate this to work for everybody running in Linux 35 | 36 | 37 | #### Do docker build 38 | 5) Install docker in your machine which you can look up in internet and then do a docker build. You also will need to install docker-compose otherwise the `docker run` command is super long. 39 | ```` 40 | $docker build -t ue4:master . 41 | ```` 42 | and wait a long time because it will download all the dependencies 43 | 44 | 6) While waiting, inspect your /dev folder by ls /dev 45 | ```` 46 | $ls /dev 47 | autofs fuse mei ram13 sda3 tty12 tty29 tty45 tty61 ttyS19 ttyS7 vcsa3 48 | block hidraw0 mem ram14 sda5 tty13 tty3 tty46 tty62 ttyS2 ttyS8 vcsa4 49 | bsg hpet net ram15 sda6 tty14 tty30 tty47 tty63 ttyS20 ttyS9 vcsa5 50 | btrfs-control input network_latency ram2 sg0 tty15 tty31 tty48 tty7 ttyS21 uhid vcsa6 51 | bus kmsg network_throughput ram3 sg1 tty16 tty32 tty49 tty8 ttyS22 uinput vcsa7 52 | cdrom kvm null ram4 shm tty17 tty33 tty5 tty9 ttyS23 urandom vga_arbiter 53 | char log nvidia0 ram5 snapshot tty18 tty34 tty50 ttyprintk ttyS24 v4l vhci 54 | console loop0 nvidiactl ram6 snd tty19 tty35 tty51 ttyS0 ttyS25 vcs vhost-net 55 | core loop1 port ram7 sr0 tty2 tty36 tty52 ttyS1 ttyS26 vcs1 video0 56 | cpu loop2 ppp ram8 stderr tty20 tty37 tty53 ttyS10 ttyS27 vcs2 watchdog 57 | cpu_dma_latency loop3 psaux ram9 stdin tty21 tty38 tty54 ttyS11 ttyS28 vcs3 watchdog0 58 | cuse loop4 ptmx random stdout tty22 tty39 tty55 ttyS12 ttyS29 vcs4 zero 59 | disk loop5 pts rfkill tpm0 tty23 tty4 tty56 ttyS13 ttyS3 vcs5 60 | dri loop6 ram0 rtc tty tty24 tty40 tty57 ttyS14 ttyS30 vcs6 61 | ecryptfs loop7 ram1 rtc0 tty0 tty25 tty41 tty58 ttyS15 ttyS31 vcs7 62 | fb0 loop-control ram10 sda tty1 tty26 tty42 tty59 ttyS16 ttyS4 vcsa 63 | fd mapper ram11 sda1 tty10 tty27 tty43 tty6 ttyS17 ttyS5 vcsa1 64 | full mcelog ram12 sda2 tty11 tty28 tty44 tty60 ttyS18 ttyS6 vcsa2 65 | ```` 66 | At this point of time, just look at your nvidia* and snd 67 | 68 | 7) Modify the docker-compose.yml file at "devices" section. Modify to suit for your host machine to expose sound card and graphic card to container. 69 | 70 | devices: 71 | ```` 72 | - "/dev/nvidia0" 73 | - "/dev/nvidiactl" 74 | - "/dev/snd/timer" 75 | - "/dev/snd/seq" 76 | - "/dev/snd/hwC0D0" 77 | - "/dev/snd/controlC0" 78 | - "/dev/snd/hwC1D3" 79 | - "/dev/snd/hwC0D1" 80 | - "/dev/snd/hwC1D2" 81 | - "/dev/snd/hwC1D1" 82 | - "/dev/snd/hwC1D0" 83 | - "/dev/snd/controlC1" 84 | - "/dev/snd/pcmC1D7p" 85 | - "/dev/snd/pcmC1D8p" 86 | - "/dev/snd/pcmC1D9p" 87 | - "/dev/snd/pcmC1D3p" 88 | - "/dev/snd/pcmC0D0p" 89 | - "/dev/snd/pcmC0D0c" 90 | ```` 91 | #### Do docker-compose 92 | 8) Once the docker build is completed. Run docker-compse run 93 | ```` 94 | $docker-compose run ue4 /bin/bash 95 | ```` 96 | which will logged in as user `unreal` 97 | 98 | 9) Now, you will be in a terminal /UnrealEngine, the following will build the Unreal Engine Editor 99 | ```` 100 | $make 101 | ```` 102 | this takes me 40 minutes. It depends on how powerful is your machine. 103 | 104 | 10) On YOUR HOST MACHINE, to enable x display from the container 105 | ```` 106 | $xhost + 107 | ```` 108 | 109 | 11) Run the Editor 110 | ```` 111 | $./Engine/Binaries/Linux/UE4Editor 112 | ```` 113 | 114 | #In future 115 | Everything will be automated til the build and you will get the Unreal Editor or codelite displayed instead of terminal 116 | 117 | A shell script should be provided to do step 2 and 7 118 | 119 | use xauthority instead of using xhost +, to make it more seamless build 120 | --------------------------------------------------------------------------------