2017-02-12 19 views
5

Mam bardzo prosty dockerfile z „rm -rf”, aby usunąć pliki instalacyjne po instalacji, ale mam jakiś błąd jak:Dockerfile „rm -rf” fail

 
Step 4/4 : RUN rm -Rf /INSTALLATION 
---> Running in 19fe828f3c9d 
rm: cannot remove '/INSTALLATION/Subsystems/Common': Directory not empty 
rm: cannot remove '/INSTALLATION/Subsystems/EMS': Directory not empty 

biegnę wszystko z roota .

Moja dockerfile:

 
FROM centos 
COPY INSTALLATION/ /INSTALLATION/ 
RUN rm -Rf /INSTALLATION 

Moje OS jest centos7 i system operacyjny hosta jest RHLE 7.

informacji

Docker

 
[[email protected] 1]# docker info 
Containers: 53 
Running: 27 
Paused: 0 
Stopped: 26 
Images: 19 
Server Version: 1.13.0 
Storage Driver: overlay 
Backing Filesystem: xfs 
Supports d_type: false 
Logging Driver: json-file 
Cgroup Driver: cgroupfs 
Plugins: 
Volume: local 
Network: bridge host macvlan null overlay 
Swarm: inactive 
Runtimes: runc 
Default Runtime: runc 
Init Binary: docker-init 
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e 
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e 
init version: 949e6fa 
Security Options: 
seccomp 
    Profile: default 
Kernel Version: 3.10.0-229.el7.x86_64 
Operating System: Red Hat Enterprise Linux Server 7.1 (Maipo) 
OSType: linux 
Architecture: x86_64 
CPUs: 24 
Total Memory: 94.41 GiB 
Name: snap460c03 
ID: T3ST:6DXJ:SDST:3W3J:Z4NB:UXF7:HGSZ:A3WH:ELHX:GVZW:APTD:7ZEK 
Docker Root Dir: /var/lib/docker 
Debug Mode (client): false 
Debug Mode (server): false 
Http Proxy: http://16.85.88.10:8080/ 
No Proxy: docker-registry 
Registry: https://index.docker.io/v1/ 
Experimental: false 
Insecure Registries: 
docker-registry:5000 
127.0.0.0/8 
Live Restore Enabled: false 

Próbowałem też nowy pojemnik i spróbuj go ręcznie, ale wynikiem jest również błąd:

 
[[email protected] 1]# docker run -it e20c9c5ffa8a /bin/bash 

[[email protected] /]# rm -Rf /INSTALLATION/Subsystems/Common/* 

[[email protected] /]# rm -Rf /INSTALLATION/Subsystems/Common 

rm: cannot remove '/INSTALLATION/Subsystems/Common': Directory not empty 

Możesz zobaczyć, że drugi rm nie działa, próbowałem rmdir, a także błąd w resule.

Chociaż ls katalogu, to pokazać:

 
ls /INSTALLATION/Subsystems/Common 
ls: cannot access /INSTALLATION/Subsystems/Common/eium-license.config: No such file or directory 
ls: cannot access /INSTALLATION/Subsystems/Common/install_jdk.sh: No such file or directory 
eium-license.config install_jdk.sh 

Można to powiedział, nie ma takiego pliku, ale postępować z plikami.

+0

Czy sprawdziłeś, które pliki zostały pozostawione w tych katalogach? – Henry

+0

Co robi 'rm -R' w przeciwieństwie do' rm -r'? – Thilo

+3

@Thilo '-r, -R, --recursive' to synonimy, wszystkie robią to samo. – Henry

Odpowiedz

-1

Wierzę, że jest to znany problem z dokowaniem.

Można spróbować wykonać następujące czynności jako obejście:

RUN rm -Rf /INSTALLATION/* 
+0

Próbowałem, wynikiem jest ten sam błąd. –

+0

Próbowałem nawet obsługiwać go ręcznie, wynikiem jest również błąd: [root @ devvm13 1] # docker run -it e20c9c5ffa8a/bin/bash [root @ f3efa193700d /] # rm -Rf/INSTALLATION/Subsystems/Common/* [root @ f3efa193700d /] # rm -Rf/INSTALACJA/Podsystemy/Common rm: nie można usunąć "/ INSTALLATION/Subsystems/Common": katalog nie jest pusty –

+0

Jeśli/INSTALLATION ma folder chid, wynikiem jest również błąd. –

0

To jest twój problem:

Supports d_type: false 

Prawdopodobnie stoi tak: https://github.com/moby/moby/issues/31283

Musisz sformatować System plików xfs, taki jak:

mkfs -t xfs -n ftype=1 -f /path/to/device 

(potrzebowaliśmy opcji siły w jakiś sposób).

Więcej informacji: https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/7.2_Release_Notes/technology-preview-file_systems.html

1

Miałem ten sam problem, po spędzeniu kilku godzin znaleźć ten problem: - https://github.com/docker/docker/issues/27358

So Long story short, oto jak naprawiłem go .

Kiedy robisz informacje w doku, w twoim wyjściu masz Storage Driver: overlay, miałem to samo, a ja zmieniłem nakładkę na devicemapper. Postępuj zgodnie z wyświetlanymi instrukcjami - https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#configure-docker-with-the-devicemapper-storage-driver

Będziesz musiał również zatrzymać i uruchomić usługę dokowania.

Uwaga: Po zmianie tracisz wszystkie swoje obrazy z przeszłości, oznacza, że ​​nie będzie widać żadnych obrazów/pojemniki po wpisaniu docker images lub docker ps.Będą tam w fileSystem, gdzie zajmą miejsce na dysku. Będziesz musiał ręcznie usunąć ten katalog, więc będzie on pod numerem /var/lib/docker/overlay.