#docker-compose #dockerfile
Вопрос:
Застрял с довольно простым docker-compose
Dockerfile
проектом . Вот Dockerfile
:
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get upgrade -y
#RUN apt-get install -y build-essential libssl-dev git libncurses5-dev unzip gawk zlib1g-dev flex vim curl wget bison python net-tools iputils-ping libflatbuffers-dev
RUN mkdir -p /opt/ide/
COPY . /home
WORKDIR /home
RUN tar -xf m2m-eclipse.tar.gz -C /opt/ide/
RUN ls /opt/ide/eclipse/
и docker-compose.yml
:
version: "2"
services:
openwrt:
build:
context: .
dockerfile: Dockerfile
container_name: openwrt_imx6ull
entrypoint: /bin/bash
volumes:
- /home/al/docker/ide/:/opt/ide/
Вот как я создаю и запускаю контейнер:
docker-compose run openwrt
со следующими журналами:
$ docker-compose run openwrt
Building openwrt
Step 1/8 : FROM ubuntu:20.04
---> fb52e22af1b0
Step 2/8 : RUN apt-get update
---> Using cache
---> ccaa8adcefd4
Step 3/8 : RUN apt-get upgrade -y
---> Using cache
---> 002dc4633463
Step 4/8 : RUN mkdir -p /opt/ide/
---> Running in 67d04fbcdf62
Removing intermediate container 67d04fbcdf62
---> cd4c9067f8c6
Step 5/8 : COPY . /home
---> 31f4b39e64d2
Step 6/8 : WORKDIR /home
---> Running in f59de03825e5
Removing intermediate container f59de03825e5
---> d05774f05db0
Step 7/8 : RUN tar -xf m2m-eclipse.tar.gz -C /opt/ide/
---> Running in 27ea2d334606
Removing intermediate container 27ea2d334606
---> 043c6f250ced
Step 8/8 : RUN ls /opt/ide/eclipse/
---> Running in 181dc628ddff
artifacts.xml
configuration
dropins
eclipse
eclipse.ini
features
icon.xpm
notice.html
p2
plugins
readme
workspace
Removing intermediate container 181dc628ddff
---> b77e96cbbcac
Successfully built b77e96cbbcac
Successfully tagged ide_openwrt:latest
WARNING: Image for service openwrt was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating ide_openwrt_run ... done
root@05e6ba5b7f02:/home#
I expect to find m2m-eclipse.tar.gz
content at /opt/ide
but it is unfortunately empty:
# ls /opt/ide/
#
if I run same tar
command from container shell I get expected result:
# tar -xf m2m-eclipse.tar.gz -C /opt/ide/
# ls /opt/ide/
eclipse
How can I get expected behaviour (extracting tar to the volumed folder)?
Seems there is obvious thing I missed.