OracleDatabaseのDocker Imageが欲しくなったのでソースコードを取得してビルドした。 以下はその時の作業ログである。

ソースコードの取得

ソースコードはOracleからダウンロードする。 https://www.oracle.com/jp/database/technologies/oracle-database-software-downloads.html#19c

ダウンロードする際、Oracleのアカウントが必要なので適宜作る。

Docker関連のファイルの取得

Oracle DatabaseのDocker関連のファイルはGithubでホスティングされている。 Gitコマンドを使って取得する。

git clone https://github.com/oracle/docker-images oracle-docker-images

Docker Imageのビルド

ダウンロードしたソースコードのzipファイルを oracle-docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0 配下に配置する。 zipファイルのまま置けば良い。

mv LINUX.X64_193000_db_home.zip oracle-docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0
ソースコードの配置

oracle-docker-images/OracleDatabase/SingleInstance/dockerfiles/ にカレントディレクトリを移動して buildContainerImage.sh を用いてイメージをビルドする。

$ cd oracle-docker-images/OracleDatabase/SingleInstance/dockerfiles
$ ./buildContainerImage.sh -v 19.3.0 -e -i
Checking Docker version.
Ignored MD5 checksum.
==========================
Container runtime info:
Client:
 Debug Mode: false
 Plugins:
  scan: Docker Scan (Docker Inc., v0.3.3)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.13-beta2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 3.849GiB
 Name: docker-desktop
 ID: B6IL:7MLJ:OYC6:HNQO:XSPL:SI4G:EYXX:XK2Q:LQ26:AJG2:QZYR:CMNK
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 39
  Goroutines: 45
  System Time: 2021-01-20T13:07:23.3955565Z
  EventsListeners: 3
 HTTP Proxy: gateway.docker.internal:3128
 HTTPS Proxy: gateway.docker.internal:3129
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

==========================
Building image 'oracle/database:19.3.0-ee' ...
[+] Building 917.0s (14/14) FINISHED                                                                                                                                                 
 => [internal] load build definition from Dockerfile                                                                                                                            0.0s
 => => transferring dockerfile: 4.09kB                                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                 0.0s
 => [internal] load metadata for docker.io/library/oraclelinux:7-slim                                                                                                           6.5s
 => [base 1/4] FROM docker.io/library/oraclelinux:[email protected]:4d9168e6703a121761f2fce07958ee1c6ca52bc666a85803a1713fc5b674ef61                                               35.3s
 => => resolve docker.io/library/oraclelinux:[email protected]:4d9168e6703a121761f2fce07958ee1c6ca52bc666a85803a1713fc5b674ef61                                                     0.0s
 => => sha256:4d9168e6703a121761f2fce07958ee1c6ca52bc666a85803a1713fc5b674ef61 547B / 547B                                                                                      0.0s
 => => sha256:2e19b9439d553aa3673b4b16dc1944e07b291f9c3cf4b122a624676f749fe570 529B / 529B                                                                                      0.0s
 => => sha256:aec958857e72cacdb3d122bbb4a64e4a5a04714989a4f0298820a755b0ad1f13 1.48kB / 1.48kB                                                                                  0.0s
 => => sha256:980316e412373040bc280150078ae453b259ece36b750a0a9b6f4c99751ce4f9 48.26MB / 48.26MB                                                                               19.5s
 => => extracting sha256:980316e412373040bc280150078ae453b259ece36b750a0a9b6f4c99751ce4f9                                                                                      13.6s
 => [internal] load build context                                                                                                                                             344.0s
 => => transferring context: 3.06GB                                                                                                                                           344.0s
 => [base 2/4] COPY setupLinuxEnv.sh checkSpace.sh /opt/install/                                                                                                                0.4s
 => [base 3/4] COPY runOracle.sh startDB.sh createDB.sh dbca.rsp.tmpl setPassword.sh checkDBStatus.sh runUserScripts.sh relinkOracleBinary.sh /opt/oracle/                      0.0s
 => [base 4/4] RUN chmod ug+x /opt/install/*.sh &&     sync &&     /opt/install/checkSpace.sh &&     /opt/install/setupLinuxEnv.sh &&     rm -rf /opt/install                 208.0s
 => [builder 1/2] COPY --chown=oracle:dba LINUX.X64_193000_db_home.zip db_inst.rsp installDBBinaries.sh /opt/install/                                                          19.8s
 => [builder 2/2] RUN chmod ug+x /opt/install/*.sh &&     sync &&     /opt/install/installDBBinaries.sh ee                                                                    203.0s 
 => [stage-2 1/3] COPY --chown=oracle:dba --from=builder /opt/oracle /opt/oracle                                                                                               53.4s 
 => [stage-2 2/3] RUN /opt/oracle/oraInventory/orainstRoot.sh &&     /opt/oracle/product/19c/dbhome_1/root.sh                                                                   0.7s 
 => [stage-2 3/3] WORKDIR /home/oracle                                                                                                                                          0.0s 
 => exporting to image                                                                                                                                                         44.2s 
 => => exporting layers                                                                                                                                                        44.2s 
 => => writing image sha256:e05319f35f357ca975e57cc897aa02ec153e74497ed3b0884932d969c6acbc1d                                                                                    0.0s 
 => => naming to docker.io/oracle/database:19.3.0-ee                                                                                                                            0.0s 


  Oracle Database container image for 'ee' version 19.3.0 is ready to be extended: 
    
    --> oracle/database:19.3.0-ee

  Build completed in 917 seconds.
  
$

ビルドが完了すると6.53GBの巨大なDocker Imageが出来上がる。

oracle/database                19.3.0-ee            e05319f35f35     2021-01-20 22:21:56     6.53GB