Setup TeamCity on Mac to work with Docker

For one of our project we decided to use TeamCity on our Mac Mini (which is under table in the same room where we are).

It was interesting experience with some pitfalls and I would like to share how we did it. Want to mention that installation of TeamCity is not subject of this article and I’m sure you can find a lot of posts about it in the internet.

One more important thing. TeamCity on our MacMini was installed to **/Library/TeamCity** folder. Docker machine shares only home directory (/Users) but some of our docker containers requires **/Library/TeamCity/hash/our project name/src** directory to be shared.

Project structure

├── docker
│   ├── application
├── scripts
└── src
    ├── app
    ├── bootstrap
    ├── config
    ├── database
    ├── public
    ├── resources
    ├── storage
    ├── tests
    └── vendor

application:
    build: ./application
    volumes:
        - ../src:/var/www/application

So, because our TeamCity loads the project inside **/Library/TeamCity** folder which is not shared between host and docker-machine we have the issue. From docker container's standpoint the folder looks empty.

Add **Library** folder to the folders list.

That’s not enough. All these steps are only shares the folder to the VM but it is not mounted yet.

Login inside docker-machine via ssh (**docker-machine ssh**) and mount /Library folder like that:

mkdir /Library && mount -t vboxsf Library /Library

Since docker-machine is heir of boot2docker we can use special boot2docker feature that allow us to run the script right after machine is started.

#!/bin/sh

mkdir /Library
mount -t vboxsf Library /Library