Skip to content

Instantly share code, notes, and snippets.

@BruceZu
Created January 4, 2017 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BruceZu/5746587089511de0d6516d8d0ac64774 to your computer and use it in GitHub Desktop.
Save BruceZu/5746587089511de0d6516d8d0ac64774 to your computer and use it in GitHub Desktop.
how to sudo root in container of docker and k8s
refer http://container-solutions.com/running-docker-in-jenkins-in-docker/
@BruceZu
Copy link
Author

BruceZu commented Jan 4, 2017

jenkinsci/docker#64
// it need root . if use k8s kubectl exec --usename need do some work in dockfile ..... sudo file...

// use docker command directly
http://kubernetes.io/docs/user-guide/docker-cli-to-kubectl/

[root@k8s-09 ~]# ssh root@k8s-05
[root@k8s-05 ~]# docker ps
[root@k8s-05 ~]#  docker exec -u root -it 243e4a450bc6  /bin/bash
 

 
root@jenkins-2377375696-8qevu:/# vim /etc/resolv.conf
bash: vim: command not found
root@jenkins-2377375696-8qevu:/# vi /etc/resolv.conf
bash: vi: command not found
root@jenkins-2377375696-8qevu:/# apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package vim

about issue of Unable to locate package vim:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment