3 Answers
I presume one would do this using a CMD layer within the container image. When you create a pod from this image the CMD layer will be executed. Just an educated guess as this is not something I have experience of
containers should be immutable, simply pro
Running the install commands after deployment would be inefficient. What you would do is create a Dockerfile, build the image, upload the image (Dockerhub is free), and then swap the image in the YAML file for the one you’ve built.
Dockerfile
======
FROM ubuntu:latest
RUN apt-get update -y && apt-get install curl
=====
Those are the only two lines you need
docker image build -t dockerhub_username/container_name:tag_name .
docker push dockerhub_username/container_name:tag_name
Build with command above, the period indicates the dockerfile is in your current directory, push it to docker hub, then your image is available to use! Just reference the image name: "dockerhub_username/container_name:tag_name"
Hope this helps!
But I guess if you wanted the quick and dirty method, you could also just add it in before the sleep command.
command: – /bin/bash – "-c" – "apt-get update -y && apt-get install curl && sleep 60m"
It seems I can’t enter new line characters, but each – should start on a new line.