Linux Containers

⏱ 5 mins remaining

Running Containers

Docker ABC ?

Let’s overview the basic docker commands

docker image ls
docker pull ubuntu:22.04
docker run -it --name ubuntu ubuntu:22.04 bash

# In another terminal
docker exec -it ubuntu date
docker ps
docker stop ubuntu
docker ps -a
docker rm -f ubuntu
docker rmi ubuntu:22.04

Running MySQL inside a container: The Ultimate command

Let’s explore the docker run command

cd $HOME
mkdir config
docker run -d \
    --name mydb \
    -p 3306:3306 \
    -v ./config:/etc/mysql/conf.d \
    -e MYSQL_ROOT_PASSWORD=my-secret-pw \
    mysql:latest