Docker

Perface

This article is an introduction and simple use of Docker and Docker Desktop.

My configs:

  1. Ubuntu22.04 & MacOS14.1

Refer:

1. Docker

1.1 What is Docker?

Docker is an open source platform that enables developers to build, deploy, run, update and manage containers—standardized, executable components that combine application source code with the operating system (OS) libraries and dependencies required to run that code in any environment. (From IBM)

1.2 What is Docker Desktop?

It provides a straightforward GUI (Graphical User Interface) that lets you manage your containers, applications, and images directly from your machine. You can use Docker Desktop either on its own or as a complementary tool to the CLI.
Docker Desktop reduces the time spent on complex setups so you can focus on writing code. It takes care of port mappings, file system concerns, and other default settings, and is regularly updated with bug fixes and security updates.

1.3 Install Docker Desktop

You can easily install matching version, just need to download .dmg bag and install it.

1.4 Simple use

# Use this to test wheter docker install successfully\
docke version

# Simple test, and will get follows
docker run hello-world

# Hello from Docker!
# This message shows your installation appears to be working correctly

Some command your may need:

# Show running contains, -a means show all whether run or not.
docker ps -a

# download image
docker pull [image_name]

# create and run new contains
docker run [images_id]

# start contains
docker start [contains_id]

# restart contains
docker restart [contains_id]

# stop running contains
docker stop [contains_id]

# force stop running contains
docker kill [contains_id]

Or you can use Docker Desktop GUI to do these:

Figure-1 User

Search images you need, and simplily click run icon, then you can use it.