Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
Kubernetes equivalent of 'docker run -it'

I have one docker image and I am using following command to run it.

docker run -it -p 1976:1976 --name demo demo.docker.cloud.com/demo/runtime:latest

I want to run the same in Kubernetes. This is my current yaml file.

apiVersion: v1
kind: Deployment
metadata:
  name: demo-deployment
  labels:
    app: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo
  template:
    metadata:
      labels:
        app: demo
    spec:
      containers:
      - name: demo
        image: demo.docker.cloud.com/demo/runtime:latest
        ports:
        - containerPort: 1976
        imagePullPolicy: Never

This yaml file covers everything except flag "-it". I am not able to find its Kubernetes equivalent. Please help me out with this. Thanks

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

I assume you are trying to connect a shell to your running container. Following the guide at https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/ - You would need the following commands. To apply your above configuration:

Create the pod: kubectl apply -f ./demo-deployment.yaml

Verify the Container is running: kubectl get pod demo-deployment

Get a shell to the running Container: kubectl exec -it demo-deployment -- /bin/bash

over 4 years ago · Santiago Trujillo Report

0

Looking at the Container definition in the API reference, the equivalent options are stdin: true and tty: true.

(None of the applications I work on have ever needed this; the documentation for stdin: talks about "reads from stdin in the container" and the typical sort of server-type processes you'd run in a Deployment don't read from stdin at all.)

over 4 years ago · Santiago Trujillo Report

0

kubectl run is the close match to docker run based on the requested scenario.

Some examples from Kubernetes documentation and it's purpose :

kubectl run -i --tty busybox --image=busybox -- sh  # Run pod as interactive shell
kubectl run nginx --image=nginx -n 
mynamespace                                         # Run pod nginx in a specific namespace
kubectl run nginx --image=nginx                     # Run pod nginx and write its spec into a file called pod.yaml
--dry-run=client -o yaml > pod.yaml

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!