How to cp data from one container to another using kubernetes How to cp data from one container to another using kubernetes kubernetes kubernetes

How to cp data from one container to another using kubernetes


How to run one container and finish a job, before another container starts using kubernetes?

Use initContainers - updated your deployment.yml, assuming example.com/nltk_data:latest is your data image

How to write to a shared volume without having that shared volume overwrite?

As you know what is there in your image, you need to select an appropriate mount path. I would use /mnt/nltk_data

Updated deployment.yml with init containers

spec:  volumes:    - name: shared-data      emptyDir: {}  initContainers:    - name: init-ikg-api-demo      imagePullPolicy: Always      # You can use command, if you don't want to change the ENTRYPOINT      command: ['sh', '-c', 'cp -r /nltk_data_source /mnt/nltk_data']      volumeMounts:        - name: shared-data          mountPath: /mnt/nltk_data      image: example.com/nltk_data:latest  containers:    - name: ikg-api-demo      imagePullPolicy: Always      volumeMounts:        - name: shared-data          mountPath: /nltk_data      image: example.com/main_api:private_key      ports:        - containerPort: 80