Skip to content

Free database container requires allowPrivilegeEscalation: true in order to run #2948

Open
@nicleary

Description

@nicleary

When running container-registry.oracle.com/database/free:23.7.0.0-amd64 on Kubernetes, with the following manifest:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: oracle
spec:
  selector:
    matchLabels:
      app: "oracle" # has to match .spec.template.metadata.labels
  serviceName: "oracle"
  replicas: 1 # by default is 1
  minReadySeconds: 10 # by default is 0
  template:
    metadata:
      labels:
        app: "oracle" # has to match .spec.selector.matchLabels
    spec:
      terminationGracePeriodSeconds: 30
      securityContext:
        runAsNonRoot: true
        fsGroup: 54321
        seccompProfile:
          type: RuntimeDefault
      containers:
      - name: oracle-db
        securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: false
            runAsNonRoot: true
            runAsUser: 54321
            runAsGroup: 54321
        image: "container-registry.oracle.com/database/free:23.7.0.0-amd64"
        imagePullPolicy: "IfNotPresent"
        ports:
          - containerPort: 1521
          - containerPort: 5500
        volumeMounts:
        - name: datamount
          mountPath: /opt/oracle/oradata
        command: ["/bin/bash", "-c", "/opt/oracle/runOracle.sh"]
        lifecycle:
          preStop:
            exec:
              command: [ "/bin/sh", "-c", "/bin/echo -en 'shutdown abort;\n' | env ORACLE_SID=${ORACLE_SID^^} sqlplus -S / as sysdba" ]
        env:
          - name: ORACLE_SID
            value: "FREE"
          - name: ORACLE_PWD
            value: "password"
  volumeClaimTemplates:
  - metadata:
      name: datamount
    spec:
      accessModes: [ "ReadWriteOncePod" ]
      resources:
        requests:
          storage: "10Gi"

The container fails to start with the following error:

Password: su: Authentication failure.

Removing allowPrivilegeEscalation: false allows startup to complete, however this is a non-viable solution in the environment this image needs to run int. Is there anyway around the requirement for privilege escalation?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions