docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

Oracle 12c ee: rm: cannot remove '/opt/oracle/install': Directory not empty

Open mikostov opened this issue 9 years ago • 6 comments

Build docker image failed with error:

Step 11/16 : RUN $ORACLE_BASE/oraInventory/orainstRoot.sh &&     $ORACLE_HOME/root.sh &&     rm -rf $INSTALL_DIR
 ---> Running in 5f639eabd490
Changing permissions of /opt/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /opt/oracle/oraInventory to dba.
The execution of the script is complete.
Check /opt/oracle/product/12.1.0.2/dbhome_1/install/root_3dc71fdbfc9c_2017-02-09_18-03-21.log for the output of root script
rm: cannot remove '/opt/oracle/install': Directory not empty
Removing intermediate container 5f639eabd490
The command '/bin/sh -c $ORACLE_BASE/oraInventory/orainstRoot.sh &&     $ORACLE_HOME/root.sh &&     rm -rf $INSTALL_DIR' returned a non-zero code: 1
There was an error building the image.

When I check intermediate container:

[root@57c2cb6aad37 /]# cd /opt/oracle/install/
[root@57c2cb6aad37 install]# ls -al
ls: cannot access linuxamd64_12102_database_1of2.zip: No such file or directory
ls: cannot access linuxamd64_12102_database_2of2.zip: No such file or directory
total 32
drwxr-xr-x. 1 oracle dba 4096 Feb  9 17:59 .
drwxr-xr-x. 1 oracle dba   82 Feb  9 17:59 ..
-rwxr-xr-x. 1 oracle dba  836 Feb  7 19:58 checkSpace.sh
-rw-rw-r--. 1 oracle dba 9114 Feb  9 17:55 db_inst.rsp
-rwxr-xr-x. 1 oracle dba 2111 Feb  7 19:58 installDBBinaries.sh
-rwxr-xr-x. 1 oracle dba 1065 Feb  7 19:58 installPerl.sh
??????????? ? ?      ?      ?            ? linuxamd64_12102_database_1of2.zip
??????????? ? ?      ?      ?            ? linuxamd64_12102_database_2of2.zip
-rwxr-xr-x. 1 oracle dba 1011 Feb  7 19:58 setupLinuxEnv.sh

and oracle user:

[root@57c2cb6aad37 install]# su - oracle
su: cannot open session: Permission denied
[root@57c2cb6aad37 install]# id oracle
uid=500(oracle) gid=500(dba) groups=500(dba),501(oinstall)

I think it has to do something with oracle-rdbms-server-12cR1-preinstall #package

buildDockerImage_output.txt

mikostov avatar Feb 09 '17 18:02 mikostov

Hi @mikostov,

This issue is probably related to the docker storage, could you please provide us the following host informations:

  • Linux distribution
  • uname -a
  • docker info

PeeZu avatar Feb 09 '17 21:02 PeeZu

Hi @PeeZu , Linux is running on Windows 10 using Virtualbox.

[mikostov@yoda ~]$ cat /etc/*release*
Oracle Linux Server release 7.3
NAME="Oracle Linux Server"
VERSION="7.3"
ID="ol"
VERSION_ID="7.3"
PRETTY_NAME="Oracle Linux Server 7.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.3
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Oracle Linux Server release 7.3
cpe:/o:oracle:linux:7:3:server
[mikostov@yoda ~]$ uname -a
Linux yoda.localdomain 4.1.12-61.1.18.el7uek.x86_64 #2 SMP Fri Nov 4 15:48:30 PDT 2016 x86_64 x86_64 x86_64 GNU/Linux
[mikostov@yoda ~]$ docker info
Containers: 2
 Running: 1
 Paused: 0
 Stopped: 1
Images: 11
Server Version: 1.13.1
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: false
 Native Overlay Diff: 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: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.1.12-61.1.18.el7uek.x86_64
Operating System: Oracle Linux Server 7.3
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.858 GiB
Name: yoda.localdomain
ID: W7QP:UHTG:TEHR:GUZU:GXDO:P7ZF:BSXC:L6M6:XQYX:DJ46:N7OB:GLS3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

mikostov avatar Feb 10 '17 06:02 mikostov

Hi,

I had the same issue and it is related to Backing Filesystem: xfs + Storage Driver: overlay | overlay2.

In order to resolve this issue on my side, I changed the Storage Driver to devicemapper.

Try this operation to reproduce outside the OracleDatabase context:

docker rm foo bar
docker rmi foo
docker run --name foo -it oraclelinux
mkdir /tmp/foo
mkdir /tmp/foo/bar
exit
docker commit -m "reproduce bug" foo foo
docker run --name bar -it foo
rm -rf /tmp/foo

Here, the operations that resolved the issue on my side:

# uninstall Docker
yum -y remove docker
rm -rf /var/lib/docker
yum -y install device-mapper device-mapper-event device-mapper-libs device-mapper-event-libs
modprobe dm_mod
yum -y install docker

At this step, retry the first use case.

PeeZu avatar Feb 10 '17 08:02 PeeZu

[mikostov@yoda ~]$ docker rm foo bar
Error response from daemon: No such container: foo
Error response from daemon: No such container: bar
[mikostov@yoda ~]$ docker rmi foo
Error response from daemon: No such image: foo:latest
[mikostov@yoda ~]$ docker run --name foo -it oraclelinux
[root@e63a706cccd7 /]# mkdir /tmp/foo
[root@e63a706cccd7 /]# mkdir /tmp/foo/bar
[root@e63a706cccd7 /]# exit
exit
[mikostov@yoda ~]$ docker commit -m "reproduce bug" foo foo
sha256:d30f80cab7075cd575cae0b9f8b4d178d30c228ad76779d954bb624c7f3097cc
[mikostov@yoda ~]$ docker run --name bar -it foo
[root@36d18a6af170 /]# **rm -rf /tmp/foo**
**rm: cannot remove '/tmp/foo': Directory not empty**

I was using package docker-engine and not docker:

[root@yoda ~]# yum -y remove docker
Loaded plugins: langpacks, ulninfo
No Match for argument: docker
No Packages marked for removal
[root@yoda ~]# yum -y remove docker-engine
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.13.1-1.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch         Version              Repository          Size
================================================================================
Removing:
 docker-engine       x86_64       1.13.1-1.el7         @docker-main        65 M

Transaction Summary
================================================================================
Remove  1 Package

Installed size: 65 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : docker-engine-1.13.1-1.el7.x86_64                            1/1 
  Verifying  : docker-engine-1.13.1-1.el7.x86_64                            1/1 

Removed:
  docker-engine.x86_64 0:1.13.1-1.el7                                           

Complete!
[root@yoda ~]# rm -rf /var/lib/docker
[root@yoda ~]# yum -y install device-mapper device-mapper-event device-mapper-libs device-mapper-event-libs
Loaded plugins: langpacks, ulninfo
Package 7:device-mapper-1.02.135-1.el7_3.2.x86_64 already installed and latest version
Package 7:device-mapper-event-1.02.135-1.el7_3.2.x86_64 already installed and latest version
Package 7:device-mapper-libs-1.02.135-1.el7_3.2.x86_64 already installed and latest version
Package 7:device-mapper-event-libs-1.02.135-1.el7_3.2.x86_64 already installed and latest version
Nothing to do
[root@yoda ~]# modprobe dm_mod
[root@yoda ~]# yum -y install docker
Loaded plugins: langpacks, ulninfo
No package docker available.
Error: Nothing to do
[root@yoda ~]# yum -y install docker-engine
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.13.1-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch         Version               Repository         Size
================================================================================
Installing:
 docker-engine       x86_64       1.13.1-1.el7          docker-main        19 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 19 M
Installed size: 65 M
Downloading packages:
docker-engine-1.13.1-1.el7.x86_64.rpm                      |  19 MB   00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : docker-engine-1.13.1-1.el7.x86_64                            1/1 
  Verifying  : docker-engine-1.13.1-1.el7.x86_64                            1/1 

Installed:
  docker-engine.x86_64 0:1.13.1-1.el7                                           

Complete!

But after starting docker daemon the storage driver was still overlay2

[root@yoda ~]# systemctl start docker
[root@yoda ~]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.13.1
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: false
 Native Overlay Diff: 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: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.1.12-61.1.18.el7uek.x86_64
Operating System: Oracle Linux Server 7.3
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.858 GiB
Name: yoda.localdomain
ID: W7QP:UHTG:TEHR:GUZU:GXDO:P7ZF:BSXC:L6M6:XQYX:DJ46:N7OB:GLS3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

I started Docker daemon with the devicemapper storage driver using the dockerd command:

[root@yoda ~]# systemctl stop  docker
[root@yoda ~]# dockerd --storage-driver=devicemapper &
[1] 2956
[root@yoda ~]# INFO[0000] libcontainerd: new containerd process, pid: 2961 
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=4096
WARN[0001] devmapper: Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section. 
INFO[0001] devmapper: Creating filesystem xfs on device docker-251:0-71602093-base 
INFO[0002] devmapper: Successfully created filesystem xfs on device docker-251:0-71602093-base 
INFO[0002] Graph migration to content-addressability took 0.00 seconds 
WARN[0002] mountpoint for pids not found                
INFO[0002] Loading containers: start.                   
INFO[0002] Firewalld running: true                      
INFO[0002] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[0003] Loading containers: done.                    
INFO[0003] Daemon has completed initialization          
INFO[0003] Docker daemon                                 commit=092cba3 graphdriver=devicemapper version=1.13.1
INFO[0003] API listen on /var/run/docker.sock      

[root@yoda ~]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.13.1
Storage Driver: devicemapper
 Pool Name: docker-251:0-71602093-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 11.8 MB
 Data Space Total: 107.4 GB
 Data Space Available: 37.3 GB
 Metadata Space Used: 581.6 kB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.147 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.135-RHEL7 (2016-11-16)
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: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.1.12-61.1.18.el7uek.x86_64
Operating System: Oracle Linux Server 7.3
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.858 GiB
Name: yoda.localdomain
ID: W7QP:UHTG:TEHR:GUZU:GXDO:P7ZF:BSXC:L6M6:XQYX:DJ46:N7OB:GLS3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

And the issue was resolved:

[mikostov@yoda ~]$ docker run --name foo -it oraclelinux
ERRO[0057] Handler for POST /v1.26/containers/create returned error: No such image: oraclelinux:latest 
Unable to find image 'oraclelinux:latest' locally
latest: Pulling from library/oraclelinux
67d242720c3e: Pull complete 
Digest: sha256:afb752ce74416f6d20568d22dce3f1dd9e8d227bc2913442733137b21c25756b
Status: Downloaded newer image for oraclelinux:latest
[root@6e065ed337fd /]# mkdir /tmp/foo
[root@6e065ed337fd /]# mkdir /tmp/foo/bar
[root@6e065ed337fd /]# exit
exit
[mikostov@yoda ~]$ docker commit -m "reproduce bug" foo foo
sha256:7adc134a09e6f8d80b64e1e9e0b456f304c456cb2ce910bf4e478eba01634587
[mikostov@yoda ~]$ docker run --name bar -it foo
[root@50e15746df81 /]# rm -rf /tmp/foo
[root@50e15746df81 /]#

Thanks @PeeZu

mikostov avatar Feb 10 '17 18:02 mikostov

Note that we do not recommend using the device-mapper backing store because it has woeful performance and is limited to 10GB (by default) which needs to be modified.

Oracle recommends using btrfs as the storage driver which is automatically enabled if /var/lib/docker exists on a btrfs file system.

Djelibeybi avatar Feb 10 '17 21:02 Djelibeybi

@Djelibeybi hey Avi, would you mind pushing a section explaining this recommendation into the top-level README ?

brunoborges avatar Feb 10 '17 21:02 brunoborges