I am trying to run two Dockers on the same Kubernetes pod and I want one of the Docker container always to run before the other. I remember learning about specifying such dependency on the pod configuration file, but can not find that now. Kubernetes documentation does not explain it either.
Here is the example pod configuration with two containers I adopted from another Stackoverflow question. How should I change this pod configuration to run container type1
before type2
?
{
"id": "podId",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "podId",
"containers": [{
"name": "type1",
"image": "local/image"
},
{
"name": "type2",
"image": "local/secondary"
}]
}
},
"labels": {
"name": "imageTest"
}
}
Thanks in advance, Nodir.
Download and install Docker Desktop as described in Orientation and setup. Work through containerizing an application in Part 2. Make sure that Kubernetes is enabled on your Docker Desktop: Mac: Click the Docker icon in your menu bar, navigate to Preferences and make sure there's a green light beside 'Kubernetes'.
Edit PODs and DeploymentsRun the kubectl edit pod <pod name> command. This will open the pod specification in an editor (vi editor). Then edit the required properties. When you try to save it, you will be denied.
The Symbiosis Between Kubernetes and Docker Quite the contrary; Kubernetes can run without Docker and Docker can function without Kubernetes. But Kubernetes can (and does) benefit greatly from Docker and vice versa. Docker is a standalone software that can be installed on any computer to run containerized applications.
Kubernetes currently does not allow specification of container startup dependencies.
There has been some discussion in GitHub issues 1996 and 1589 that might help you out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With