<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ruslan&#39;s Tech Blog</title>
    <link>https://blog.bekenev.net/tags/docker-devops.html</link>
    <description>Software development related stuff</description>
    <language>en-us</language>
    <lastBuildDate>Mon, 20 Jun 2016 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bekenev.net/tags/docker-devops/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Setup TeamCity on Mac to work with Docker</title>
      <link>https://blog.bekenev.net/2016/06/20/docker-machine-docker-and-teamcity.html</link>
      <pubDate>Mon, 20 Jun 2016 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2016/06/20/docker-machine-docker-and-teamcity.html</guid>
      <description>&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;It was interesting experience with some pitfalls and I would like to share how we did it.&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;One more important thing. TeamCity on our MacMini was installed to &lt;strong&gt;/Library/TeamCity&lt;/strong&gt; folder.&#xA;Docker machine shares only home directory (/Users) but some of our docker containers requires &lt;strong&gt;/Library/TeamCity/hash/our project name/src&lt;/strong&gt; directory to be shared.&lt;/p&gt;&#xA;&lt;h1&gt;How does our project directory structure look&lt;/h1&gt;&#xA;&lt;br/&gt;&#xA;&lt;p&gt;Project structure&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;├── docker&#xA;│   ├── application&#xA;├── scripts&#xA;└── src&#xA;    ├── app&#xA;    ├── bootstrap&#xA;    ├── config&#xA;    ├── database&#xA;    ├── public&#xA;    ├── resources&#xA;    ├── storage&#xA;    ├── tests&#xA;    └── vendor&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;&#xA;Our `docker-compose.yml` looks similarly to this:&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;application:&#xA;    build: ./application&#xA;    volumes:&#xA;        - ../src:/var/www/application&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;&#xA;&lt;p&gt;So, because our TeamCity loads the project inside &lt;strong&gt;/Library/TeamCity&lt;/strong&gt; folder which is not shared between host and docker-machine we have the issue. From docker container&amp;rsquo;s standpoint the folder looks empty.&lt;/p&gt;&#xA;&lt;h1&gt;What to do.&lt;/h1&gt;&#xA;&lt;br/&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Open VirtualBox Manager.&lt;/li&gt;&#xA;&lt;li&gt;Choose your docker-machine (default - in my case)&lt;/li&gt;&#xA;&lt;li&gt;Press Settings.&lt;/li&gt;&#xA;&lt;li&gt;Go to Shared Folders tab and press Add new shared folder (folder with + icon at the right hand side)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a target=&#34;_blank&#34; href=&#34;https://blog.bekenev.net/assets/img/vbox_manager_gui.png&#34;&gt;&lt;img alt=&#34;vbox manager gui&#34; src=&#34;https://blog.bekenev.net/assets/img/vbox_manager_gui.png&#34; width=&#34;600px&#34;/&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Add &lt;strong&gt;Library&lt;/strong&gt; folder to the folders list.&lt;/p&gt;&#xA;&lt;p&gt;That’s not enough. All these steps are only shares the folder to the VM but it is not mounted yet.&lt;/p&gt;&#xA;&lt;p&gt;Login inside docker-machine via ssh (&lt;strong&gt;docker-machine ssh&lt;/strong&gt;) and mount /Library folder like that:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mkdir /Library &amp;amp;&amp;amp; mount -t vboxsf Library /Library&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;&#xA;And…. DONE!&#xA;Congratulations! Oh yeah, after docker-machine restart everything will gone…&#xA;&lt;a target=&#34;_blank&#34; href=&#34;https://blog.bekenev.net/assets/img/thanks_satan.gif&#34;&gt;&lt;img alt=&#34;thanks satan&#34; src=&#34;https://blog.bekenev.net/assets/img/thanks_satan.gif&#34; width=&#34;600px&#34;/&gt;&lt;/a&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Login inside of docker-machine (docker-machine ssh)&lt;/li&gt;&#xA;&lt;li&gt;go to - /var/lib/boot2docker/&lt;/li&gt;&#xA;&lt;li&gt;create bootlocal.sh file&lt;/li&gt;&#xA;&lt;li&gt;open it and enter the next few lines&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir /Library&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mount -t vboxsf Library /Library&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&#xA;That’s it. Now you can stop/start your docker-machine and after it will be started it execute bootlocal.sh file and this file will create /Library folder and mount host’s /Library folder to the guest /Library one.&#xA;</description>
    </item>
  </channel>
</rss>
