In this tutorial I use sudo in front of Docker. My user of choice is not in docker group. If you want to omit sudo then please add your user to docker group.
1. Cloning the project from Github:
Make a directory to host the git clone:
mkdir search_app
cd search_app
Actual cloning:
git clone https://github.com/postman721/Search_engines.git
Get the binary and rename it to be a bit nicer:
mv Search_engines/executables/Search\ engines-linux.zip .
unzip ‘Search engines-linux.zip’
mv ‘Search engines-linux’ search_app
2. Making a Dockerfile
echo “
FROM debian:11-slim
RUN apt update && apt upgrade -y && apt-get clean
COPY search_app /
RUN chmod +x /search_app
CMD /search_app” > Dockerfile
3.Testing the Docker image on a local machine
sudo docker build -t test .
sudo docker run test
4.Create Azure Container registry
Assumption: You have working Azure account already at this point.
- Go to azure.microsoft.com (*Always verify links yourself before clicking).
- Sign in.
- Click: Create a resource -> Containers -> Container Registry -> Create.
5. Fill in the details as Azure tells you to.
Editors note: As I was creating my Docker registry I forgot to Enable Admin user. This feature is important if you want to use the docker login command from your local workstation.
I later enabled this feature under Container registries -> your_registry_here-> Access keys -> Admin user.
6. Tag your image to be Azure registry “friendly” and push it – You need to go back to the folder which had your Dockerfile and its materials in it.
*Get your Azure Docker registry name from: Container registries ->your_registry_here -> Login server (this is a line in the Gui.)
sudo docker build -t /folder/image:tag .
For example sudo docker build -t notmyreal_registry.azurecr.io/nodejs/seach_app:v1 .
Login to your registry (Get your access credentials from the section Container registries -> your_registry_here -> Access keys):
sudo docker login notmyreal_registry.azurecr.io
7. Once you get: Login Succeeded, then push your rightly tagged image to Azure Container registry
sudo docker push notmyreal_registry.azurecr.io/nodejs/seach_app:v1
You should now see your image under: Container registries ->your_registry_here -> Services -> Repositories
Alternatively, you could just use the cli:
sudo docker images notmyreal_registry.azurecr.io/nodejs/seach_app
On the next part of this tutorial the actual application will be deployed and get to be visible via Azure resources.