How to avoid redundancy and loss of time when restoring images during development?

As a Vagrant user, when I tried Docker, I noticed one significant difference between the development workflow with Vagrant and Docker - with Docker I need to rebuild my image every time from scratch, even if I made minor changes to the code.

This is the main problem for me, because the image recovery process is often very redundant and time consuming.

Perhaps there are some smart workflows with Docker already invented, if so, what are they?

+4
source share
4 answers

', (). , , ... . , (-). , docker , Docker . , , (, apt-get update) , . , .

, / - , - -v --volume docker run.

, , , - . , , , ( ...), ( AUFS), . , Chef, . , , , - , , ( - - ).

, , bash script, ( Smola @GitHub):

#!/bin/bash
IMAGES="${IMAGES:-stratio/base:test stratio/mesos:test stratio/spark-mesos:test stratio/ingestion:test}"
LATEST_TAG="${LATEST_TAG:-test}"
for image in $IMAGES ; do
    USER=${image/\/*/}
    aux=${image/*\//}
    NAME=${aux/:*/}
    TAG=${aux/*:/}
    DIR=${NAME}/${TAG}
    pushd $DIR
    docker build --tag=${USER}/${NAME}:${TAG} .
    if [[ $TAG = $LATEST_TAG ]] ; then
        docker tag ${USER}/${NAME}:${TAG} ${USER}/${NAME}:latest
    fi
    popd
done
+2

vagrant-cachier docker bash . , .

, vagrant-cachier, , + 300 , . , , 1-5 , , LOC , .

, . , docker, , .

baseimages - , .

, fgrehm, , .

+2

, ( -)

, Docker Dockerfile .

COPY data/package.json /data/
RUN cd /data && npm install

COPY data/ /data

, Docker npm .

, , , /, (, COPY . /data/

fig ( ) . , - .

- , nginx - ( www, ).

: script :

if [[ $DEBUG ]]; then
  /usr/bin/supervisorctl start gulp
else
  /usr/bin/supervisorctl start nginx
fi

autostart=false supervisord.conf.

-, , gulp , , gulp-connect, python/django, . .

if [[ $DEBUG ]] ..., , (nginx). , 1 -, .. www:8080, - , .

0

, . .

0

All Articles