How To Set Up Docker
This article has been written as a quick set of instructions on how to set up Docker. We’ve included setup steps for both Windows and Linux below.
Install Docker Desktop:
Download and install Docker Desktop from the Docker website. You can download it from the following link: https://www.docker.com/products/docker-desktop
Once Docker Desktop is installed, open it and configure it as per your system requirements
1. Open Docker Desktop:
Once Docker Desktop is installed, open it.
2. Go to Settings:
Click on the Docker icon in the system tray and then click on "Settings".
3. Configure Resources:
In the "Settings" window, click on "Resources" from the left-hand side menu. Here, you can configure the CPU, memory, and disk space that Docker can use.
4. Configure Shared Drives:
If you want to access files on your local machine from Docker containers, you need to configure shared drives. Click on "Shared Drives" from the left-hand side menu, and then select the drive(s) you want to share.
5. Configure Proxies:
If you are behind a corporate firewall or proxy, you may need to configure Docker to work with it. Click on "Proxies" from the left-hand side menu, and then configure the proxy settings as per your requirements.
6. Save Changes:
After configuring Docker as per your system requirements, click on "Apply & Restart" to save the changes.
After the above is completed, skip down the General Gitlab Setup Section below
Ubuntu Linux Setup
1. Update the package index:
sudo apt-get update
2. Install the necessary packages to allow apt to use a repository over HTTPS:
sudo apt-get install \
3. Add Docker's official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
4. Add the Docker repository to your system:
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
5. Update the package index again:
sudo apt-get update
6. Install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io
7. Verify that Docker is installed and running:
sudo docker run hello-world
This command will download a test image and run a container using it. If everything is working correctly, you should see a message indicating that Docker is installed and running properly.
Genal GitLab Setup
1. Create a GitLab Repository:
Create a new repository on GitLab that you want to use with Docker.
2. Clone the Repository:
Clone the repository to your local machine using a Git client or using the command line.
3. Create a Dockerfile:
Create a new file in the repository and name it Dockerfile. The Dockerfile contains instructions for building a Docker image.
4. Build the Docker Image:
Run the following command in the command prompt to build the Docker image:
docker build -t <image_name> .
Replace <image_name> with the name of the image you want to create. The "." at the end of the command specifies that the build context is the current directory.
5. Tag the Docker image with the GitLab registry URL:
For example, if your GitLab registry is hosted at gitlab.example.com, you would tag the image like this:
docker tag <image-name> <registry-url>/<project-name>/<image-name>:<tag>
Replace <image-name> with the name of your Docker image, <registry-url> with the URL of your GitLab registry, <project-name> with the name of your GitLab project, and <tag> with the tag you want to use for the image.
6. Run the Docker Image:
Once the image is built, you can run it using the following command:
docker run <image_name>
Replace <image_name> with the name of the image you created in step 6.
7. Push the Docker Image to GitLab:
After you have tested the Docker image locally, you can push it to GitLab using the following commands:
docker push <registry-url>/<project-name>/<image-name>
Replace <registry-url> with the URL of your GitLab registry, <project-name> with the name of your GitLab project, <image-name> with the name of your Docker image.