Day 6 : Package Management Docker Part 1 🚀 How to Pull MySQL Docker: A Step-by-Step Guide 🐳
Step 1: Install Docker
- Install Docker with:
sudo apt install
docker.io
Step 2: Run Docker Command
- Check running containers:
sudo docker ps
Step 3: Add Docker User
- Add yourself to Docker group:
sudo usermod -aG docker $USER
Step 4: Restart Docker
Restart Docker service:
sudo systemctl restart docker
Reboot for changes to take effect:
sudo reboot
Step 5: Docker Pull
- Pull MySQL image:
docker pull mysql:latest
Step 6: List Docker Images
- See all Docker images:
docker images
Step 7: Run MySQL Image
- Run MySQL container:
docker run -d -e MYSQL_ROOT_PASSWORD=123 mysql:latest
Step 8: Access MySQL Container
Open interactive terminal:
docker exec -it 18d46949f092 sh
Access MySQL:
mysql -u root -p
- Enter password:
123
- Enter password:
Show databases:
SHOW DATABASES;
Step 9: Create Dockerfile
Edit Dockerfile:
vim Dockerfile
Build Docker image:
docker build . -t java-app
Step 10: Manage Docker Containers
Kill container:
docker kill 468ba5101ef3
Remove container:
docker rm 468ba5101ef3
Understanding Docker Components:
Docker Daemon: Background service 📦
Docker CLI: Command-line tool ⌨️
Docker Containers: Running instances 🚢
Understanding Docker Basics:
Images: Application blueprints 🖼️
Dockerfile: Build instructions 📄
Docker Image: Executable package 🚀
Docker Containers: Running instances 🏃
Exploring Docker Engines:
Docker Engines build images or pull from Docker Hub.
docker pull
: Fetch from Docker Hubdocker build
: Build images
Dockerfile Fundamentals:
- Start with a base image 📄
Feel free to reach out if you have any questions! 🌟