Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
27
Help us understand the problem. What is going on with this article?
@Satoshi_Numasawa

docker-sync

More than 1 year has passed since last update.

description

  • docker for mac では volume同期が遅い
  • docker-sync を用いて, 高速化する

prepare docker-sync

console
gem install docker-sync
brew install eugenmayer/dockersync/unox
brew install fswatch unison rsync

prepare docker files

  • 以下 Files を作成
    • Dockerfile
    • docker-compose.yml
    • docker-compose-dev.yml
    • docker-sync.yml

Dockerfile

Dockerfile
FROM centos:7.5.1804

WORKDIR /opt/django/

docker-compose.yml

docker-compose.yml
version: '2'

services:
  django:
    build:
      context: ./
      dockerfile: ./Dockerfile
    working_dir: /opt/django/
    tty: true

docker-compose-dev.yml

docker-compose-dev.yml
version: '2'


volumes:
  django_syncs:
    external: true

services:
  django:
    volumes:
      - django_syncs:/opt/django/:nocopy

docker-sync.yml

docker-sync.yml
version: '2'


options:
  compose-dev-file-path: 'docker-compose-dev.yml'

syncs:
  django_syncs:
    src: './'
    sync_strategy: 'unison'

start sync

console
docker-compose pull
docker-compose build --no-cache
# start sync and docker
#     docker-compose-dev.ymlにて, 設定を上書きしている
docker-sync start
docker-compose -f ./docker-compose.yml -f ./docker-compose-dev.yml up -d

# open console
docker-compose exec django /bin/bash

# stop
docker-sync stop
docker-compose down
# 以下では sync + up を一括で実行する
# 停止は ctrl + c
docker-sync-stack start

以上で同期が高速化する.

参考

https://qiita.com/pocari/items/0340049742927f3a94b7
https://github.com/EugenMayer/docker-sync/wiki
https://github.com/EugenMayer/docker-sync/wiki/8.-Strategies

27
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Satoshi_Numasawa
サムネイル引用元はこちら. https://www.pixiv.net/en/users/1007401
ruby-dev
Ruby開発はRuby on Railsをコア技術とし、Web系から基幹系まで多様な開発に携わっています。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
27
Help us understand the problem. What is going on with this article?