Day 6 : Package Management Docker Part 1 🚀 How to Pull MySQL Docker: A Step-by-Step Guide 🐳

Day 6 : Package Management Docker Part 1 🚀 How to Pull MySQL Docker: A Step-by-Step Guide 🐳

Step 1: Install Docker

  1. 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

  1. Restart Docker service: sudo systemctl restart docker

  2. 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

  1. Open interactive terminal: docker exec -it 18d46949f092 sh

  2. Access MySQL: mysql -u root -p

    • Enter password: 123
  3. Show databases: SHOW DATABASES;

Step 9: Create Dockerfile

  1. Edit Dockerfile: vim Dockerfile

  2. 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 Hub

  • docker build: Build images

Dockerfile Fundamentals:

  • Start with a base image 📄

Feel free to reach out if you have any questions! 🌟