I want to mount the local directory of a project to docker container before I used COPY command but when I make changes I have to rebuild those parts which involve some installation from bash scripts.
This is my docker-compose
file
version "3.7"
services
tesseract:
container_name: tesseract
build:
context: ./app/services/tesseract/
dockerfile: Dockerfile
volumes:
- ./app/services/tesseract:/tesseract/
I don't have any errors when building and my WORKDIR tesseract
is empty when i run container
This is my Dockerfile
FROM ubuntu:19.10
ENV DEBIAN_FRONTEND=noninteractive
ENV TESSERACT=/usr/share/tesseract
WORKDIR /tesseract
RUN apt-get update && apt-get install -y \
build-essential \
software-properties-common \
python3.7 \
python3-pip \
cmake \
autoconf \
automake \
libtool \
pkg-config \
libpng-dev \
tesseract-ocr \
libtesseract-dev \
libpango1.0-dev \
libicu-dev \
libcairo2-dev \
libjpeg8-dev \
zlib1g-dev \
libtiff5-dev \
wget \
git \
g++ \
vim
RUN git clone https://github.com/tesseract-ocr/tesseract $TESSERACT
COPY . /tesseract/
RUN chmod +x scripts/*
RUN scripts/compile_tesseract.sh
RUN scripts/langdata_lstm.sh scripts/start.sh
RUN pip3 install -r requirements.txt
ENV TESSDATA_PREFIX=/usr/share/tesseract/tessdata
Main objective of docker volume is
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.
which means volumes are used to persist the data outside the lifecycle of a container. If you want to COPY
a file or a directory into a container, please use COPY
instruction.
If you're copying in local files to your Docker image, always use
COPY
because it's more explicit.
With Docker-compose, you can use a bind mount volume
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.