-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
PotatoScript edited this page Feb 16, 2025
·
2 revisions
Before you begin, ensure you meet the following requirements:
- Operating System: Windows, macOS, or Linux.
- Admin/Root Access: You need admin privileges to install Docker.
-
Hardware Requirements:
- At least 4GB of RAM.
- Sufficient disk space to download Docker images and containers.
- Visit the official Docker website.
- Download the installer for your operating system:
- Windows: Docker Desktop for Windows.
- macOS: Docker Desktop for macOS.
- Linux: Install Docker Engine via your package manager (detailed below).
- Double-click the downloaded Docker Desktop installer.
- Follow the installation wizard:
- Accept the license agreement.
- Enable "Use WSL 2-based engine" (recommended for better performance).
- After installation, restart your system if prompted.
- Launch Docker Desktop and sign in with your Docker Hub account (create one if you don’t have it).
- Open the
.dmgfile you downloaded. - Drag the Docker icon to your Applications folder.
- Launch Docker from Applications and complete the setup wizard.
- Sign in with your Docker Hub account.
- Update your package manager:
sudo apt update && sudo apt upgrade - Install required packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg - Add the Docker repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Install Docker Engine:
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
- Start and enable Docker:
sudo systemctl start docker sudo systemctl enable docker
- Open a terminal or command prompt.
- Run the following command to verify Docker is installed correctly:
Example output:
docker --version
Docker version 20.10.12, build e91ed57. - Run the Docker "Hello World" container:
This will pull the
docker run hello-world
hello-worldimage from Docker Hub and run it, verifying that Docker is working correctly.
-
Set Up WSL 2 on Windows (if not already done):
- Install WSL 2:
wsl --install - Set WSL 2 as the default engine in Docker Desktop settings.
- Install WSL 2:
-
Manage Docker as a Non-Root User (Linux Only):
- Create a Docker group:
sudo groupadd docker
- Add your user to the Docker group:
sudo usermod -aG docker $USER - Log out and log back in to apply the changes.
- Create a Docker group:
To push and pull images to/from Docker Hub:
- Log in to Docker from the terminal:
docker login
- Enter your Docker Hub username and password.
To ensure Docker is up to date:
- On Windows/macOS: Docker Desktop will prompt for updates.
- On Linux:
sudo apt update && sudo apt upgrade docker-ce
Try running these basic commands:
- List running containers:
docker ps
- List all containers:
docker ps -a
- Pull an image from Docker Hub:
docker pull ubuntu:latest
- Run a container:
docker run -it ubuntu bash
-
Permission Denied (Linux):
Ensure your user is added to the
dockergroup. -
Service Not Starting:
Restart the Docker service:
sudo systemctl restart docker
- Network Issues: Check your firewall or VPN settings.
With Docker set up and running, you're ready to start building and managing containers! 🎉
- A kernel manages applications and hardware resources
- Window share the Linux kernel so window can run Linus application container
- Install Docker https://docs.docker.com/get-docker/
- Work-Flow
- Add
Dockerfilewhich is a plain instruction to pack the application into an image - Image contain everything that the application need to run
- Load the Image into a container for processing and let us run our application on local machine
- we can also push the Image into the Registry or Docker-Hub which is the storage of Image so that everyone can use
- other can pull the Image from the Docker-Hub to run or use the application (as the same way as our development machine)
- Add