Mahalliy docker rasmlarni Minikube bilan qanday ishlatiladi?

minikube bilan foydalanmoqchi bo'lgan bir nechta docker rasmlari bor. Avval mahalliy rasmni to'g'ridan-to'g'ri ishlatish o'rniga, bitta rasmni yuklab olishni va yuklab olishni xohlamayman. Qanday qilaman?

Men sinab ko'rdim: Foydalanuvchining profili 1. Men bu buyruqlarni ishga tushirishga harakat qildim (alohida-alohida, ikkala minikubaning misollarini o'chirish va yangi boshlash)

kubectl run hdfs --image=fluxcapacitor/hdfs:latest --port=8989
kubectl run hdfs --image=fluxcapacitor/hdfs:latest --port=8989 imagePullPolicy=Never

Chiqish:

NAME                    READY     STATUS              RESTARTS   AGE
hdfs-2425930030-q0sdl   0/1       ContainerCreating   0          10m

Bu faqat ba'zi holatga yopishib qoladi, lekin hozirgi holatga hech qachon etib bormaydi.


2. I tried creating a registry and then putting images into it but that didn't work either. I might've done that incorrectly but I can't find proper instructions to do this task.

Mahalliy kubernetlarda mahalliy docker rasmlarni ishlatish uchun ko'rsatmalar bering. Foydalanuvchining profili OS: ubuntu 16.04 Foydalanuvchining profili Docker: Docker versiya 1.13.1, 092cba3 qurish Foydalanuvchining profili Kubernetes:

Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.3", GitCommit:"029c3a408176b55c30846f0faedf56aae5992e9b", GitTreeState:"clean", BuildDate:"2017-02-15T06:40:50Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"1970-01-01T00:00:00Z", GoVersion:"go1.7.1", Compiler:"gc", Platform:"linux/amd64"}

Agar kimdir men uchun docker-compose dan foydalanadigan yechim topishga yordam berishi mumkin bo'lsa, bu ajoyib bo'lar edi. Rahmat.

Tahrirlash:

eval $ (minikube docker-env ) -ga yuklangan rasmlar:

REPOSITORY                                            TAG                 IMAGE ID            CREATED             SIZE
fluxcapacitor/jupyterhub                              latest              e5175fb26522        4 weeks ago         9.59 GB
fluxcapacitor/zeppelin                                latest              fe4bc823e57d        4 weeks ago         4.12 GB
fluxcapacitor/prediction-pmml                         latest              cae5b2d9835b        4 weeks ago         973 MB
fluxcapacitor/scheduler-airflow                       latest              95adfd56f656        4 weeks ago         8.89 GB
fluxcapacitor/loadtest                                latest              6a777ab6167c        5 weeks ago         899 MB
fluxcapacitor/hdfs                                    latest              00fa0ed0064b        6 weeks ago         1.16 GB
fluxcapacitor/sql-mysql                               latest              804137671a8c        7 weeks ago         679 MB
fluxcapacitor/metastore-1.2.1                         latest              ea7ce8c5048f        7 weeks ago         1.35 GB
fluxcapacitor/cassandra                               latest              3cb5ff117283        7 weeks ago         953 MB
fluxcapacitor/apachespark-worker-2.0.1                latest              14ee3e4e337c        7 weeks ago         3.74 GB
fluxcapacitor/apachespark-master-2.0.1                latest              fe60b42d54e5        7 weeks ago         3.72 GB
fluxcapacitor/package-java-openjdk-1.8                latest              1db08965289d        7 weeks ago         841 MB
gcr.io/google_containers/kubernetes-dashboard-amd64   v1.5.1              1180413103fd        7 weeks ago         104 MB
fluxcapacitor/stream-kafka-0.10                       latest              f67750239f4d        2 months ago        1.14 GB
fluxcapacitor/pipeline                                latest              f6afd6c5745b        2 months ago        11.2 GB
gcr.io/google-containers/kube-addon-manager           v6.1                59e1315aa5ff        3 months ago        59.4 MB
gcr.io/google_containers/kubedns-amd64                1.9                 26cf1ed9b144        3 months ago        47 MB
gcr.io/google_containers/kube-dnsmasq-amd64           1.4                 3ec65756a89b        5 months ago        5.13 MB
gcr.io/google_containers/exechealthz-amd64            1.2                 93a43bfb39bf        5 months ago        8.37 MB
gcr.io/google_containers/pause-amd64           
77

7 javoblar

README tasvirlanganidek, siz Docker xizmatini Minikubadan eval $ (minikube docker-env) bilan qayta ishlatish.

Shunday qilib, uni yuklamasdan tasvirdan foydalanish uchun quyidagi bosqichlarni bajarishingiz mumkin:

  1. set the environment variables with eval $(minikube docker-env)
  2. build the image with the Docker daemon of Minukube (eg docker build -t my-image .)
  3. set the image in the pod spec like the build tag (eg my-image)
  4. set the imagePullPolicy to Never, otherwise Kubernetes will try to download the image.

Important note: You have to run eval $(minikube docker-env) on each terminal you want to use, since it only sets the environment variables for the current shell session.

135
qo'shib qo'ydi
Tasvirlarni qayta tiklashga urinishdan oldin siz ishlayotgan terminalni yopganingizdan so'ng eval $ (minikube docker-env) ni ishga tushirishni eslash juda muhim ... minikubada yangilanish ... bir to'plami yangilanmaganday tuyuldi ... albatta, minikubaning havola qilinayotgan tasvirini yangilamayotgani yo'q.
qo'shib qo'ydi muallif Mike, manba
eval $ (minikube docker-env) dan keyin docker-da bo'sh joyni qanday oshirish mumkin? Bir nechta rasmni qo'shgandan so'ng, dockerda bo'sh joy yo'qligini aytadi.
qo'shib qo'ydi muallif Kapil Gupta, manba
Katta rahmat! Bu javob menga yordam berdi.
qo'shib qo'ydi muallif himanshuIIITian, manba
ImagePullPolicy-ni o'zgartirishga harakat qilinganda, Minikube xato hosil qiladi
qo'shib qo'ydi muallif Jason, manba
AFAIS siz faqatgina minikube start -disk-size 100g bilan yangi minukube bilan buni amalga oshirishingiz mumkin. Boshqa bir yechim eski kodlarni docker images va docker rmi bilan o'chirib tashlash bo'ladi.
qo'shib qo'ydi muallif svenwltr, manba
@Jason Buning uchun yana bir savol paydo bo'lishi kerak. Bundan tashqari: xato bo'lishi mumkin.
qo'shib qo'ydi muallif svenwltr, manba
1-bosqichdan so'ng imidjni yaratishga qodir bo'lmagandim. Keyin minikube to'xtatish va minikyuda boshladim. Endi imidjni qurishga muvaffaq bo'ldim (2 bosqich)
qo'shib qo'ydi muallif Shailesh kumar, manba
Standart pul siyosati IfNotPresent - bu biz bajarishimiz kerak bo'lgan muhit o'zgaruvchilarini o'rnatishdir.
qo'shib qo'ydi muallif Beygi, manba

Bu javob minikube bilan chegaralanmagan!

Mahalliy ro'yxatga olish vositasidan foydalaning:

docker run -d -p 5000:5000 --restart=always --name registry registry:2

Keling, rasmingizni to'g'ri yozing:

docker tag ubuntu localhost:5000/ubuntu

Localhost, ro'yxatga olish konteynerini ishlaydigan mashinaning DNS nomiga o'zgartirish kerakligini unutmang.

Endi rasmingizni mahalliy ro'yxatga olish uchun bosing:

docker push localhost:5000/ubuntu

Uni qaytarib olishingiz kerak:

docker pull localhost:5000/ubuntu

Endi mahalliy registrni ishlatish uchun yaml faylingizni o'zgartiring.

Tasvirlarni ro'yxatga olishda davom etish uchun tegishli joyga o'rnatish hajmini o'ylab ko'ring.

47
qo'shib qo'ydi
dahshatli yechim!
qo'shib qo'ydi muallif Misterhex, manba

@Svenwltr tomonidan hal qilingan echim asosida menga nima ishlagan:

# Start minikube
minikube start

# Set docker env
eval $(minikube docker-env)

# Build image
docker build -t foo:0.0.1 .

# Run in minikube
kubectl run hello-foo --image=foo:0.0.1 --image-pull-policy=Never

# Check that it's running
kubectl get pods
35
qo'shib qo'ydi
Rahmat, men izlayotgan javob bo'ldi!
qo'shib qo'ydi muallif Edison Gustavo Muenz, manba

Qabul qilingan javobga qo'shimcha ravishda siz quyidagi buyruq bilan siz boshlagan narsalarni ( run buyrug'i yordamida tarqatish yaratishingiz mumkin) erishishingiz mumkin:

kubectl run hdfs --image=fluxcapacitor/hdfs:latest --port=8989 --generator=run-pod/v1 

Kubernetes-dev forumida generator haqida ma'lumotni topdim:

If you're using kubectl run, it generates a manifest for you that happens to have imagePullPolicy set to Always by default. You can use this command to get an imagePullPolicy of IfNotPresent, which will work for minikube:

kubectl run --image= --generator=run-pod/v1

Dan Lorenc

https://groups.google.com/forum/#!topic/ kubernetes-dev/YfvWuFr_XOM

5
qo'shib qo'ydi

Bir yondashuv mahalliy imidjni yaratish va keyin bajarishdir:

docker save imageNameGoesHere | pv | (eval $(minikube docker-env) && docker load)
4
qo'shib qo'ydi
Faqatgina eval $ (minikube docker-env) yozuvi ZSH-da muammo bo'lishi mumkin, shuning uchun u holda Bashni ishlating.
qo'shib qo'ydi muallif Chris Stryczynski, manba

Kubernetlarda hujjat:

https://kubernetes.io/docs/concepts/containers/images/# yangilanish-rasmlarni

Kubeletning agar u allaqachon mavjud bo`lsa, tasvirni olishni boshlashiga sabab bo`ladigan ifrita siyosati. Agar siz doimo tortishni majbur qilmoqchi bo'lsangiz, quyidagilardan birini amalga oshirishingiz mumkin:

     
      
  • Konteynerning imagePullPolicy'i har doim «
  • ga sozlang   
  • foydalaning: ishlatiladigan tasvir uchun yorliq sifatida eng so'nggi;
  •   
  • AlwaysPullImages qabul qilish boshqaruvini faollashtirish.
  •   

Yoki boshqa usulni o'qing: So'nggi yorlig'i yordamida rasmlarni har doim tortib olinishiga majbur qiladi. Yuqorida aytib o'tilganidek, eval $ (minikube docker-env) dan foydalansangiz, unda hech qanday teg ishlatmang yoki mahalliy rasmingizga tagni belgilang, chunki siz Kubernetesni majburan tortib olishga harakat qilasiz.

1
qo'shib qo'ydi

Agar oldingi javoblarni kiritish uchun tarball tasviringiz bo'lsa, uni faqatgina mahalliy docker rasmiga o'rnatishingiz mumkin docker image load -i /path/image.tar . Uni ishga tushirishni unutmang eval $ (minikube docker-env) dan so'ng, chunki minikube tasvirlarni mahalliy o'rnatilgan docker dvigateli bilan almashmaydi.

0
qo'shib qo'ydi