Last active
September 6, 2023 21:43
-
-
Save todd-dsm/5cc9afaa08be59c64153cc0c02992399 to your computer and use it in GitHub Desktop.
run a container that accepts commands and arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an initContainer: | |
# REF: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ | |
# It is configured in a pod like any other container, except that it is | |
# specified inside its own "initContainers" section. | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: myapp-pod | |
labels: | |
app: myapp | |
spec: | |
containers: | |
- name: myapp-container | |
image: busybox:1.28 | |
command: ['sh', '-c', 'echo The app is running! && sleep 3600'] | |
resources: | |
requests: | |
cpu: "250m" | |
memory: "64Mi" | |
limits: | |
cpu: "500m" | |
memory: "128Mi" | |
initContainers: | |
- name: init-myservice | |
image: busybox | |
command: ['sh', '-c', 'git clone <some-repository-that-will-be-used-by-application> ;'] | |
# * Use initContainers when attempting to run any command or task that will only | |
# be run one time after the pod is created. The initContainer will complete | |
# its task before the main container is started. | |
# * If any of the initContainers fail to complete, Kubernetes restarts the Pod | |
# repeatedly until the Init Container succeeds. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dockerfiles are fairly straightforward. This is an overly simplified container that:
I would only spend time on building a container and focus on the ENTRYPOINT directive.
Building a container that accepts commands and args from Kubernetes
yaml
(example: L15 above) then that's a majority of the Docker's value. For everything else, there's buildpacks.