#Gitlab #GitlabContainerRegistry #Dockerfile #techwithfoyzur
You can support me here 🙏
https://buymeacoffee.com/techwithfoyzur
In this video, I will show you how to use the GitLab container registry aka GitLab registry. We are going to use docker in GitLab. GitLab Container Registry is a secure and private registry for Docker images. The GitLab set of tools includes a container registry. It is a hosted registry built with open source tools that are secure and private. It can host OCI-compatible images and provides a fully-featured integration with GitLab. This allows users to manage all their GitLab DevOps tooling in one space. It is available in their free tier.
🈯️Timestamps 🈯️
00:00 Intro
00:38 Write a Dockerfile
01:55 Write index.html
05:03 Build the Dockerfile
06:59 Docker run the container
08:05 Docker exec to the container
09:33 How to tag a docker image
10:20 Docker login
11:10 Docker commit
11:48 How to push a docker image
13:39 Gitlab container regsitry
⏩ Dockerfile
FROM ubuntu:16.04
add metadata
LABEL version="1.0.0"
to turn off the questions asked for location and timezone
ARG DEBIAN_FRONTEND=noninteractive
update repository and install apache2 web server
RUN apt-get update -y && \
apt-get install apache2 apache2-utils curl -y && \
apt-get clean
copy index.html file to /var/www/html
COPY index.html /var/www/html
expose on port 80
EXPOSE 80
start the apache service as soon as container is created
CMD ["apachectl","-D","FOREGROUND"]
Steps:
1. Write a simple Dockerfile.We will write a simple Dockerfile for the apache webserver
let's create a simple HTML file -
⏩ docker build -t="apache_webserver" -f Dockerfile .
⏩ docker images`
2. Run a docker container from that image
⏩ docker run -d -p 80:80 apache_webserver`
⏩ docker ps
⏩ docker exec -it 89203f2139e0 bash
⏩ service apache2 status
3. Let's push this image to GitLab registry
⏩ docker tag 208555db15e4 registry.gitlab.com/youtube27/git-gitlab-tutorial/apache_webserver:latest
⏩ docker login registry.gitlab.com -u suomen_luonto
⏩ docker ps
⏩ docker commit -m "Adding apache webserver" 89203f2139e0 registry.gitlab.com/youtube27/git-gitlab-tutorial/apache_webserver
⏩ docker push registry.gitlab.com/youtube27/git-gitlab-tutorial/apache_webserver:latest
▶️ Useful links:
*️⃣ Dockerfile
https://docs.docker.com/engine/refere...
*️⃣ Docker Build
https://docs.docker.com/engine/refere...
*️⃣ Docker commit
https://docs.docker.com/engine/refere...
*️⃣ Docker tag
https://docs.docker.com/engine/refere...
*️⃣ Docker push
https://docs.docker.com/engine/refere...
*️⃣ Gitlab Container Registry
https://docs.gitlab.com/ee/user/packa...
*️⃣ HTML
https://www.w3schools.com/html/