Why i cant create file inside container?

What i want do is create container and create file inside the container. so thought first try would be to list files so i ran.
kubectl run test-nginx --restart=Never --image nginx:alpine -- /bin/bash -c "ls". It works as expected. Next would be kubectl run test-nginx --restart=Never --image nginx:alpine -- /bin/bash -c "touch index.txt". But it fails. why it cant just create file inside the container.

But it’s not working for me.

That means given shell is not available inside the Pod’s container. Try to change to the sh then it will work.

1 Like

1 Like