Can I run Xcode in a docker container? I'd like to dockerise an Xcode CI system, just wondering if this is possible.
-
3My guess is no: http://stackoverflow.com/questions/2406151/can-you-run-xcode-in-linux – Abdullah Jibaly Feb 18 '15 at 02:47
-
Would love to be wrong though – Abdullah Jibaly Feb 18 '15 at 02:47
-
I suspect you're right – Chris Feb 18 '15 at 02:51
-
1It might be possible to run xcodebuild or facebook's xctool, however the iOS simulator, which you'd need for unit tests, wouldn't be do-able i imagine – Chris Feb 18 '15 at 02:54
-
I guess that would require Xcode command line tools to work on linux (as xctool requires these to build projects) – NSTJ May 06 '15 at 01:02
-
Related: https://stackoverflow.com/questions/49237506/how-to-dockerize-xcode – Christian Jan 27 '20 at 08:45
3 Answers
This answer is now likely to be out of date as it was written in 2015. It may still be useful as reference to reproduce the same
--
This repo from Docker Hackathon 2015 describes how to build and run iOS apps with the docker client. Is that what you're after?
Watch the video:
Secret sauce is in server.js that implements a REST API to simulate a docker server. So in fact it's not actually running iOS in a real Linux docker server - rather it implements the docker API and then acts as a proxy to ios-sim (run) and XCode (build).

- 21,638
- 3
- 67
- 78
-
-
25I don't believe this achieves what the original question was about? My interpretation was that @Chris was hoping to migrate his unit test / build setup from a (presumably OSX machine-based) continuous integration server to a Docker-based CI system (such as Bitbucket Pipelines?). My use case is just that: Bamboo hosted on OSX machine -> Bitbucket Pipelines. – Johnus Jul 06 '16 at 05:59
-
2I'm not successful in implementing this. It uses XCode image which I am not sure where it gets from since it is not in Docker libraries. – Vimalraj Selvam Jul 30 '16 at 05:42
-
What this does: they created a docker registry server that can receive a Dockerfile and then call xcodebuild (that should be locally installed). The advantages of Docker (containers that can be configured, spawned and thrown away after usage) are not used this way (unfortunately). (Although this is a very creative way to run xcodebuild :-) ) – raoel Feb 14 '17 at 19:50
-
6I don't think this is a valid answer. The author of the repo himself says [here](https://github.com/jkingyens/docker4xcode/issues/1) that >The xcode:7.0 docker image is **not actually a docker image**. In this case Xcode:7.0 just tells the build tools to build using xcode 7 on OSX platform. This base "image" is basically the existing development environment on your mac. I wanted to make it look like a traditional dockerfile as much as possible (and match the concepts). – Mig82 Mar 12 '18 at 14:48
-
So that means if you set up a hackintosh - you can use said Docker Image with that secret sauce. Somebody tell me if this won't work, pls :-) – Lenny Feb 28 '19 at 14:46
-
This code was written in 2015 and it's likely that the Docker API has now moved on. – Tony O'Hagan Aug 28 '19 at 23:13
-
Look at Docker-OSX which runs macOS with Xcode support inside Docker.
You can connect to that macOS via SSH or VNC and use Xcode on Linux

- 2,206
- 2
- 19
- 18
Circle CI has an option to use Xcode in a container. Here is an excerpt of my ci pipleline config:
ios-build-env: &ios-build-env
macos:
xcode: "11.4.1"
jobs:
ios-deploy:
<<: *ios-build-env
steps:
- checkout
...
Circles docs: https://circleci.com/docs/2.0/testing-ios/

- 826
- 9
- 12