LoginSignup
2
2

More than 5 years have passed since last update.

DockerでBitbucket Serverを動かす

Last updated at Posted at 2016-08-27

DockerでBitbucket Serverを動かすときに詰まったのでメモ

環境

  • CentOS Linux release 7.2.1511
  • Docker version 1.10.3
  • Bitbucket Server 4.8.5

データディレクトリのパーミッションでこける

Docker HubにAtlassian公式っぽいBitbucket Seerverのページがあったので、そこに書いてある手順に従ってインストール。最初はデータディレクトリのボリュームのパーミッションの変更を行う。

Set permissions for the data directory so that the runuser can write to it:

$> docker run -u root -v /data/bitbucket:/var/atlassian/application-data/bitbucket atlassian/bitbucket-server chown -R daemon  /var/atlassian/application-data/bitbucket

実行したところ、以下の様なエラーが出た。

chown: changing ownership of ‘/var/atlassian/application-data/bitbucket’: Permission denied`

Dockerではホストのディレクトリをコンテナにマウントするとコンテナ上で所有者が1000:1000になるらしいので元のDockerfileをいじったりしてみたが、どうにもうまくいかなかった。ちなみにマウントしたディレクトリの所有者はコンテナ上でbin:bin(uid=2、gid=2)だった。。。

SELinuxのせいだった

いろいろ調べてたらSELinuxが原因ということが判明。SELinuxには何度も手こずらされている。。。
-vオプションの最後に:zをつけて、以下にようなコマンドにしたら動作した。

docker run -u root -v /data/bitbucket:/var/atlassian/application-data/bitbucket atlassian/bitbucket-server:z chown -R daemon  /var/atlassian/application-data/bitbucket

続けてコンテナを起動。

Start Atlassian Bitbucket Server:

$> docker run -v /data/bitbucket:/var/atlassian/application-data/bitbucket --name="bitbucket" -d -p 7990:7990 -p 7999:7999 atlassian/bitbucket-server

http://localhost:7990にアクセスすると無事動作しているのを確認。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2