Nginx Ingress Controller Docker image for ARM32 (Raspberry Pi) - nginx

Is there a Nginx Ingress Controller Docker image available for ARM32, which will run on a Raspberry PI 3?
I have tried this:
$ docker run gcr.io/google_containers/nginx-ingress-controller:0.8.3
standard_init_linux.go:195: exec user process caused "exec format error"
Is there some documentation / list of images with more details on which tags available for the images on gcr.io/google_containers?

Support for arm64 was introduced with 0.9.0-beta.12. I don't believe there's an arm32 compatible release.
As for how to know which images or tags are available on gcr you can either run these:
gcloud container images list-tags [HOSTNAME]/[PROJECT-ID]/[IMAGE]
gcloud container images list --repository=[HOSTNAME]/[PROJECT-ID]
Or just hit http://[HOSTNAME]/[PROJECT-ID]/[IMAGE] with your browser, where for the nginx-controller it would be http://gcr.io/google_containers/nginx-ingress-controller

Related

Selenium/standalone-firefox docker on raspberry pi not working: how to use RSelenium on a raspberryPi

I am trying to use RSelenium on a raspberry pi 3 B+. I managed to get R and RSelenium installed.
I first tried to use rsDriver(browser = "firefox"), but I did not manage to get it work (it ends up with an error saying Could not open firefox browser).
As it is recommended to use RSelenium with docker, I am trying to get docker run a Selenium/firefox standalone container.
I managed to get docker up and running. The hello-world run works, as well as an ubuntu bash (docker run -it ubuntu bash gets me an ubuntu terminal).
I pulled a standalone-firefox image with a given version (the 3)
here are the images I have:
ubuntu latest f576a39bda44 2 weeks ago 46.7MB
selenium/standalone-firefox 3 d803a00f9219 3 weeks ago 756MB
hello-world latest 618e43431df9 10 months ago 1.64kB
I then do
sudo docker run -d -p 4445:4444 selenium/standalone-firefox:3
But there is no container when I do docker ps, and
sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
351866263f7b selenium/standalone-firefox:3 "/opt/bin/entry_poin…" 10 seconds ago Exited (1) 6 seconds ago fervent_noether
shows that the container exited directly when executed. I tried with standalone-firefox:2.53.0 (pulling and executing), and it resulted in the same problem. What I am doing wrong ? The version of standalone-firefox is not supported by the raspberry pi ?
More generally, does someone know how to get RSelenium working on a raspberry pi (with firefox as browser)?
Edit
Following LinPy answer, I tried pulling docker images of selenium browsers compatible with the raspberry pi arm architecture. I found these:
https://hub.docker.com/u/kynetiv/
https://hub.docker.com/r/deinchristian/rpi-selenium-node-firefox
https://hub.docker.com/u/pun4drunk/
The docker containers ran without problem, but I never manager to have the remoteDriver connected to the broswer in RSelenium (different errors for different reasons, I do not detail here).
The only way I found to use RSelenium on the raspberry-pi without distant server was to execute the java selenium standalone server you can find here (I tried the 2.53.0):
java -jar selenium-server-standalone-2.53.0.jar
And then connect to it in R:
library(RSelenium)
rmDr <- remoteDriver(port = 4444L)
rmDr$open()
It was that easy in the end.
I think there is a missmatch between your app and the os ARCH . Actually it seems like application build for amd64, but you try start it on arm.
so check your Docker / APP versions and make sure they are compatible....
see this and this
You used the docker container incorrectly. You actually can see your container doing docker ps -a, but it is not good. You specified -p argument and didn't pass any port to that, and you passed the image without a tag. Follow the official documentation for this image and try again step by step:
https://github.com/SeleniumHQ/docker-selenium

Uploading personal docker image to Azure Container Registry - ErrImagePull

I am building a small docker image of this way:
In my Dockerfile I am adding an specific configuration in etc/apache2/apache2.conf about redirect http to https rule:
Specifically this rule
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
</VirtualHost>
So, my Dockerfile is
FROM wordpress:5.2.4
RUN apt-get update && apt-get install -y \
nano wget
COPY etc/apache2/apache2.conf /etc/apache2/apache2.conf
So, when it finish, I got two images in my local docker environment
REPOSITORY TAG
customize_wordpress 5.2.4
wordpress 5.2.4
Being customize_wordpress:5.2.4 my personal image and wordpress:5.2.4 the base public image that I used at FROM instruction above in the Dockerfile
Like my purpose is upload my custom image customize_wordpress:5.2.4 to azure container registry, I am following this article in order to do it
I am doing the docker tag command of this way
docker tag customize_wordpress:5.2.4 registryname.azurecr.io/customize_wordpress:5.2.4
And it works.
Also I push the image and it works as well
⟩ docker push registryname.azurecr.io/customize_wordpress:5.2.4
The push refers to repository [registryname.azurecr.io/customize_wordpress]
b63469233da6: Pushed
b032b61b15b2: Pushed
12fe3564ccac: Pushed
4e9b2aba858c: Pushed
b67d19e65ef6: Pushed
5.2.4: digest: sha256:dc62844f946a49f2e724fa38bad6e2cab73a4561b22b690876ab5534febd3569 size: 5128
[I]
So, I have these data as a environment variables in order to pass them to the helm command
export acr_login_server=registryname.azurecr.io
export acr_repository=customize_wordpress
export image_tag=5.2.4
But when I did the helm command
⟩ helm3 install wordpress-site-4 ./Deployments/Kubernetes/HelmCharts/wordpress/ --set image.registry=$acr_login_server,image.repository=$acr_repository,image.tag=$image_tag,image.pullPolicy=Always,wordpressUsername=$wordpressUsername,wordpressPassword=$wordpressPassword,wordpressEmail=$wordpressEmail,mariadb.enabled=false,externalDatabase.host=$database_host,externalDatabase.user=$database_user,externalDatabase.password=$database_password,externalDatabase.database=$database_name,externalDatabase.port=3306
I could see in my kubernetes environment that the pod say that the image is not pulled. I got
Error response from daemon: pull access denied for customize_wordpress, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Warning Failed 2m20s (x4 over 3m39s) kubelet, aks-defaultpool-34253081-vmss000001 Error: ErrImagePull
Normal Pulling 2m21s (x4 over 3m40s) kubelet, aks-defaultpool-34253081-vmss000001 Pulling image "customize_wordpress:5.2.4"
Warning Failed 2m20s (x4 over 3m39s) kubelet, aks-defaultpool-34253081-vmss000001 Failed to pull image "customize_wordpress:5.2.4": rpc error: code = Unknown desc = Error response from daemon: pull access denied for customize_wordpress, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Warning Failed 2m20s (x4 over 3m39s) kubelet, aks-defaultpool-34253081-vmss000001 Error: ErrImagePull
Normal BackOff 114s (x6 over 3m38s) kubelet, aks-defaultpool-34253081-vmss000001 Back-off pulling image "customize_wordpress:5.2.4"
Warning Failed 103s (x7 over 3m38s) kubelet, aks-defaultpool-34253081-vmss000001 Error: ImagePullBackOff
I am doing this helm command from azure devops, and previously I logged in to my ACR of multiple ways such as:
echo "Log in to an Azure Container Registry"
# docker login $(acr_login_server) --username $(service_principal_name_ci-cd-app-id) --password $(service_principal_name_ci-cd-password)
az acr login --name $(acr_name)
But the result is the same from the pod, I cannot pull the image
That's why I consider that I don't need to reference the docker registry secrets inside kubernetes and in the imagePullSecrets attribute in the helm chart values.yaml.
Despite everything I try to create that docker registry secret with my acr data but the result is the same as well.
How can I upload my customize image and pull it from Kubernetes?
Like my AKS cluster and my azure container registry, both already do exist before the private image installation, I didn't realize that I had to associate the aks cluster with the Azure container registry
It says here https://learn.microsoft.com/en-us/azure/aks/cluster-container-registry-integration#configure-acr-integration-for-existing-aks-clusters
So, this is the complete workflow to build our private docker image, uploaded to our private container registry (in my case Azure Container Registry) and pull that image from Azure Kubernetes service:
Build the image
docker build -t customize_wordpress:5.2.4 .
It creates the customize_wordpress:5.2.4 image
Creating tag: We need to create a tag in order to upload our image to our ACR
We have to include in the tag our ACR host server, in my case registryname.azurecr.io
Here for more information and here
⟩ docker tag customize_wordpress:5.2.4 registryname.azurecr.io/customize_wordpress:5.2.4
Push the image: Please, we have to be sure of use our complete tag created in the immediately previous step, I mean registryname.azurecr.io/customize_wordpress:5.2.4
⟩ docker push registryname.azurecr.io/customize_wordpress:5.2.4
The push refers to repository [registryname.azurecr.io/customize_wordpress]
b63469233da6: Pushed
b032b61b15b2: Pushed
b67d19e65ef6: Pushed
5.2.4: digest: sha256:dc62844f946a49f2e724fa38bad6e2cab73a4561b22b690876ab5534febd3569 size: 5128
And then before to install my Wordpress application, in my case from helm chart command (referenced above in my question), here comes the configuration of my ACR to work with my AKS cluster
I execute the aks update command:
⟩ az aks update -n MyClusterName -g MyResourceGroup --attach-acr MyACRName
So, when I install my helm chart, the image is up and running
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 14m default-scheduler Successfully assigned default/wordpress-site-4-6565b8c64f-w7xvq to aks-defaultpool-34253081-vmss000000
Normal Pulling 14m kubelet, aks-defaultpool-34253081-vmss000000 Pulling image "registryname.azurecr.io/customize_wordpress:5.2.4"
Normal Pulled 14m kubelet, aks-defaultpool-34253081-vmss000000 Successfully pulled image "registryname.azurecr.io/customize_wordpress:5.2.4"
Normal Created 14m kubelet, aks-defaultpool-34253081-vmss000000 Created container wordpress
If we do that, we don't need to reference the docker registry secret and any imagePullSecrets attribute in our helm chart or yaml file, our image will be pulled without reference any credentials

Docker dynamic load balancing with Nginx

I'm doing an internship focused on Docker and I have to load-balance an application which have a client, a server and a database. I use Nginx as a load-balancer and my goal is to dynamically scale the number of server containers according their CPU usage. For instance if the CPU usage is over 60% I want to add a new container on the fly without restarting Nginx to divide the CPU usage.
I have to modify the nginx.conf file to add a new container but I have to restart the Nginx container to apply the changes, which is very slow.
So my question is : is there a (free) way to do it dynamically ?
Tell me if you want further information and forgive my poor english.
Thanks.
EDIT : I did as #Konstantin Azizov told me :
docker cp ./new.conf $(docker ps -f "name=dockerizedrubis_nginx" -q ):/etc/nginx/nginx.conf
docker exec $(docker ps -f "name=dockerizedrubis_nginx" -q) bash -c 'kill -HUP $(cat /run/nginx.pid)'
docker exec $(docker ps -f "name=dockerizedrubis_nginx" -q) bash -c '/etc/init.d/nginx reload'
The configuration file is well pasted in the container supporting Nginx, I send the HUP signal to reconfigure the Nginx process et then I reload to apply my changes. There are no errors and the reload on-the-fly works fine but my new nodes are not taken into account by Nginx, the requests are still only directed to the first node created ...
EDIT 2 : I found the origin of the problem. It seems like in order to update the /etc/hosts of a container after a 'docker-compose scale', this container needs to be stopped, removed and restarted. In my case, I really don't want to stop the container supporting Nginx.
Question : Anyone has an idea of how to update /etc/hosts of a container after a re-scale without having to restart the container (beside a dirty script) ?
Thanks.
I used the nginx-proxy image from Json Wilder for a while to load balance between containers, and it works for more than one scalable service. It monitors the docker daemon and if an event happens it rebuilds the nginx config file adding the new container instances when you are scaling out or removing it if you are scaling in.
Since Docker 1.10 (not sure if this is the correct version) there is a internal DNS embedded into Docker daemon, so since then I am using the round robin feature from it. Now I am using the oficial nginx image to proxy pass the requests to the a domain that I define as alias into network options. I do not know if I was clear due to my poor english but I believe my Github example may help.
Unfortunately there is no easy(free) way to change configuration without restarting, the only way to achieve zero-downtime scaling it's graceful restart, when you restarting Nginx gracefully it will spawn new instance with new configuration wait until it boots up and then kill old instance with the previous configuration.
See official guide.

Trying docker in docker getting TCP connection refused error

I am trying to run docker in docker and getting TCP 127.0.0.1:5000: connection refused. Can someone explain why this happened and how I can fix it.
Here is what I have tired:
docker run -it --privileged --name docker-server-test -d docker:1.7-dind
docker run --rm --link docker-server:docker docker:1.7 pull my-server:5000/qe/busybox
Unable to find image 'docker:1.7' locally
Trying to pull repository docker.io/library/docker ... 1.7: Pulling from library/docker
f4fddc471ec2: Already exists
da0daae25b21: Already exists
413668359dd0: Already exists
ab205815427f: Already exists
e8ace195c6b6: Already exists
2129588b76a3: Already exists
63f71ebd654b: Already exists
f3231b3888dd: Already exists
d449c5a1e017: Already exists
library/docker:1.7: The image you are pulling has been verified.
Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:c3666cc6458e02d780492c75acf1b0bf3424c8dd6882361438a9b93b46c2aa55
Status: Downloaded newer image for docker.io/docker:1.7
Pulling repository my-server:5000/qe/busybox
Get http://localhost:5000/v1/repositories/qe/busybox/tags: dial tcp 127.0.0.1:5000: connection refused
It looks like you're trying to pull an image from a registry running on your local machine -- in this case when you specify localhost as the place to pull the image from, it's trying to pull from localhost relative to the Docker daemon container (which isn't where your registry is listening). You probably want to instead pull from host-ip:5000/qe/busybox (likely something like 192.168.0.x:5000/qe/busybox).
Did you have env variable set? Based on your OS, set following Docker env variables if not already set:
DOCKER_HOST
DOCKER_CERT_PATH
DOCKER_TLS_VERIFY
You can get these details from your docker client
docker-machine env default

Docker restart not showing the desired effect

I have a small nginx based test application that I want to run inside a docker container. So I followed the example given here docker installation
So I have a foder name restartTest and it contains an index.html file that has this single line in it that says Docker Test 1. I mount this up as my volume during runtime for docker container. So the commmand I use is
docker run -dP -v /Users/Sachin/restartTest/:/usr/share/nginx/html --name engine2 nginx
And it runs fine. I use curl to verify that the volume has mounted properly and the application is running as desired. Now what I do is that I change the content of the index.html file (from my localhost) to Docker test 2 and then I restart the container. I execute the following command to verify that the content has indeed changed inside the docker container
docker exec engine2 cat /usr/share/nginx/html/index.html
And as expected, the file reads Docker Test 2. However, when I use the curl command to see if the webpage also reflects the change I see that I still get Docker Test 1 as the response. The index.html reflects the change however when I run the curl command or if I access the app from the browser, I still get the same result. I have tried the following but to no avail.
Restart the service
Stop and start the container
Stop and start the boot2docker VM and docker daemon.
I have no clue as to why this is happening.
So I found this known bug with VirtualBox VM that is used for running Docker on Mac.
When we have shared content between our host machine and the VirtualBox, then only we face this bug. There is a optimisation as far as web servers like nginx, apache (and apparently vertx) are concerned. Whenever we request a static file from the server, it uses sendfile to provide us with the file. The bug is that in case of VirtualBox (in the scenario described above) we always get the first version of the file no matter what we try. The workaround for this in case of nginx and apache is to turn sendfile off . However, there is a hack that we use as far as vertx is concerned.
rename the file say login.html to login.html.moved (anything)
curl :/….../login.html (we won’t get anything)
rename the file back to its original name login.html.moved to login.html
Hard refresh the page (Command + Shift + R).
For further reading about this bug consult the following
Link1
Link2
Link3
Link4
I assume it is a caching problem. Did you try to set expires -1 in your index.html location configuration to disable server side caching for static files?

Resources