Put Docker in a virtual machine (Ubuntu Server 20.04) running on macOS. Basically, put it as described in the Official Guide.
By the way, the reason why you shouldn't put Docker directly on your Mac is [it seems that it is notorious that "Docker for Mac is slow!"](Https://www.google.com/search?q=mac+docker+%E9% 81% 85% E3% 81% 84 & oq = mac + docker + & aqs = chrome.2.69i57j0l7.2424j0j7 & sourceid = chrome & ie = UTF-8).
In my case, using SSH tonga (guest OS host name) and bali (also guest OS host name I connected to .com / hajime-f / items / ea34a38a405f48b1ce65) and did the following (Reference: Use the computer while thinking about the southern island -f / items / 2c10db500bc40d1f8e29)))
Update the package index with update, then make apt available to the repository over HTTPS.
$ sudo apt-get install \
> apt-transport-https \
> ca-certificates \
> curl \
> gnupg-agent \
> software-properties-common
Then add the official Docker GPG Key (https://xtech.nikkei.com/it/article/Keyword/20091204/341579/) to apt.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Let's check if the fingerprint is correct. It is OK when `` `9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88``` is displayed as shown below.
$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <[email protected]>
sub rsa4096 2017-02-22 [S]
Then add the stable repository to apt.
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Install the latest version of Docker CE and containerd. Don't forget to update as we added the repository earlier.
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Run the Hello World container and you should see something like the following:
$ sudo docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
A simple translation is as follows.
Welcome to Docker!
If you see this message, your installation is successful.
To print this message, Docker takes the following steps:
1.The Docker client connects to the Docker daemon.
2.Docker daemon from DockerHub"hello-world"Get the image.
3.The retrieved image runs the executable that produces the output you are looking at,
The Docker daemon creates a new container from this image.
4.The Docker daemon passes this output to the Docker client and
The Docker client sends this output to your terminal.
I'm not sure what it is, but in short, the Docker client, which is the interface with the user, communicates with the Docker daemon, and the Docker daemon creates a container from the specified image and runs it, and shows the result via the client. Is that the place?
If you have successfully installed Docker, you should have a Docker group, so check that first.
$ cat /etc/group | grep docker
docker:x:998:
Add yourself to the "docker" group.
$ sudo usermod -aG docker hajime-f
If you log in again, you should be able to run `` `$ docker run hello-world``` without sudo.
Download the stable version of Docker Compose from GitHub.
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" \
> -o /usr/local/bin/docker-compose
Grant execute permission to Docker Compose.
$ sudo chmod +x /usr/local/bin/docker-compose
Good grief. Now you can finally use Docker. Next, let's write in the Dockerfile and play with it.
I played ... "Building a development environment for Django + MySQL + nginx with Docker Compose"
Recommended Posts