<p>I'm using the following docker image: <code>https://github.com/budtmo/docker-android</code> It's Docker image for Android emulators.</p>

<p>I'm run It using Kubernetes with the following deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: android-deployment
spec:
  selector:
    matchLabels:
      app: android-emulator
    replicas: 10
  template:
    metadata:
    labels:
        app: android-emulator
     spec:
       containers:
       - name: android-emulator
         image: budtmo/docker-android-x86-8.1
         ports:
         - containerPort: 6080
         - containerPort: 5554
         - containerPort: 5555
         env:
         - name: DEVICE
           value: "Samsung Galaxy S8"
</code></pre>

<p>After the container is running its automatic  start  the Android emulator (don't know exactly how).
I need to run python script automatic after the container is up for each running container,
How can I do it? What should I change in my deployment file?</p>

samisaviv
<p>You could simply create a <code>Dockerfile</code> to build your own image from the <code>budtmo/docker-android-x86-8.1</code> base image and deploy this. Within the <code>Dockerfile</code> you define the start command or entrypoint.</p>

<p><strong>UPDATE</strong></p>

<p>I think I understand, correct me, if I am wrong: You want run your python script against the Android emulator running in Kubernetes.</p>

<p>As I said, I am not really firm with Kubernetes but couldn't you run the Android emulator as an init container, and the python script itself in the "main" container?</p>

<p>Like described here: <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/pods/init-containers/</a></p>
