how docker-registry persist images in openshift origin

5/5/2020

i'm new to openshift/kubernetes/docker and i was wondering where the docker registry of openshift origin persist the images , knowing that :

1.in the deployment's yaml of the docker registry , there is only emptyDir volumes declaration

  volumes:
    - emptyDir: {}
      name: registry-storage

2.in the machine where the pod is deployed i can't see no volume using

docker volumes ls

3.the images are still persisted even if i restart the pod

docker registry deployment's yaml :

apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  creationTimestamp: '2020-04-26T18:16:50Z'
  generation: 1
  labels:
    docker-registry: default
  name: docker-registry
  namespace: default
  resourceVersion: '1844231'
  selfLink: >-
    /apis/apps.openshift.io/v1/namespaces/default/deploymentconfigs/docker-registry
  uid: 1983153d-87ea-11ea-a4bc-fa163ee581f7
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    docker-registry: default
  strategy:
    activeDeadlineSeconds: 21600
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      creationTimestamp: null
      labels:
        docker-registry: default
    spec:
      containers:
        - env:
            - name: REGISTRY_HTTP_ADDR
              value: ':5000'
            - name: REGISTRY_HTTP_NET
              value: tcp
            - name: REGISTRY_HTTP_SECRET
              value: 
            - name: REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ENFORCEQUOTA
              value: 'false'
            - name: OPENSHIFT_DEFAULT_REGISTRY
              value: 'docker-registry.default.svc:5000'
            - name: REGISTRY_HTTP_TLS_CERTIFICATE
              value: /etc/secrets/registry.crt
            - name: REGISTRY_OPENSHIFT_SERVER_ADDR
              value: 'docker-registry.default.svc:5000'
            - name: REGISTRY_HTTP_TLS_KEY
              value: /etc/secrets/registry.key
          image: 'docker.io/openshift/origin-docker-registry:v3.11'
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 5000
              scheme: HTTPS
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
          name: registry
          ports:
            - containerPort: 5000
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 5000
              scheme: HTTPS
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
          securityContext:
            privileged: false
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /registry
              name: registry-storage
            - mountPath: /etc/secrets
              name: registry-certificates
      dnsPolicy: ClusterFirst
      nodeSelector:
        node-role.kubernetes.io/infra: 'true'
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: registry
      serviceAccountName: registry
      terminationGracePeriodSeconds: 30
      volumes:
        - emptyDir: {}
          name: registry-storage
        - name: registry-certificates
          secret:
            defaultMode: 420
            secretName: registry-certificates
  test: false
  triggers:
    - type: ConfigChange
status:
  availableReplicas: 1
  conditions:
    - lastTransitionTime: '2020-04-26T18:17:12Z'
      lastUpdateTime: '2020-04-26T18:17:12Z'
      message: replication controller "docker-registry-1" successfully rolled out
      reason: NewReplicationControllerAvailable
      status: 'True'
      type: Progressing
    - lastTransitionTime: '2020-05-05T09:39:57Z'
      lastUpdateTime: '2020-05-05T09:39:57Z'
      message: Deployment config has minimum availability.
      status: 'True'
      type: Available
  details:
    causes:
      - type: ConfigChange
    message: config change
  latestVersion: 1
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  unavailableReplicas: 0
  updatedReplicas: 1

to restart : i just delete the pod and a new one is created since i'm using a deployment

i'm creating the file in the /registry

-- AMAR BESSALAH
docker
docker-registry
docker-volume
kubernetes
openshift-origin

1 Answer

5/5/2020

Restarting does not mean the data is deleted, it still exist in the container top layer, suggest you get started by reading this.

Persistence is, for example in Kubernetes, when a pod is deleted and re-created on another node and still maintains the same state of a volume.

-- omricoco
Source: StackOverflow