This article is the 21st day entry of "Docker Advent Calendar 2020". I was thinking of writing on my blog regardless of ad-care, but I slipped in because the calendar was just open.
Docker Desktop for Mac and Windows | Docker
Windows 10 Home Edition also made Docker installation much easier. Docker Compose is also available as standard.
In the old days (about 2 years ago), I couldn't install it on Home Editio (Hyper-V couldn't be used), and Docker Compose has difficulty even if I use WSL It used to be obstructed in all directions, but a while ago, WSL2 support and Hyper-V support were advanced in Home, and Docker Desktop became available. People (I) who struggled before and used after all, put Docker in Linux of VM as it is can install Docker on Windows again and create an environment using Remote Container of VS Code etc. think.
--Windows 10 Home version 1909 (OS build 18363.1256) 64-bit (RAM 8GB) -(Old Let's Note J10)
Docker Desktop for Mac and Windows | Docker
Download "Docker Desktop Installer.exe" from here. 3.0.0 as of December 21, 2020
There are often articles that describe settings using PowerShell and preparations such as "Enable Hyper-V" and "Enable virtual machine platform" in "Turn Windows features on or off". I don't really need it. The Docker installer will do it for you.
Run the downloaded Docker Desktop Installer.exe. Leave the default check and press "OK".
By the way, in the case of Windows 10 Pro, the check for enabling Hyper-V is also displayed, but the installation flow is the same for Home and Pro with the default check.
Wait for a while and the installation will be completed. Click "Close and restart" to restart the Windows OS.
That's really too easy to do, but installing WSL2 requires additional work. When Windows starts, the following dialog "WSL 2 installation is in complete." Is displayed.
You need to update the Linux kernel used by WSL2, so go to the link provided. (Leave this dialog displayed)
https://aka.ms/wsl2kernel (By the way, as of December 21, 2020, the link is in Japanese)
As you can see, download and run (install) the WSL2 Linux Kernel Update Package for x64 Machines (msi file).
Click "Next" to start the installation and complete it fairly quickly.
When you are done, press "Finish" to close the screen.
Now that the preparation for WSL2 is complete, press "Restart" in the dialog that was displayed first. This restart will restart the Docker process, not Windows.
By the way, before this restart, the Docker icon resident in the task tray is in a red error state.
This is what you get when you restart.
This completes the installation. You can also confirm that the required features are enabled even if you have not preset "Turn Windows features on or off".
When the installation is completed, restarted, waited for a while, and Docker started normally, the Docker Desktop screen will start as shown below.
There is a tutorial that can be completed in about 2 minutes, so if you want to try it, press "Start".
Like this, the command is displayed on the left side, so you can try building and executing Docker by executing it in the terminal on the right side as it is.
When the tutorial screen starts, you can also check the version from the terminal etc. with the CLI.
PS C:\Users\zaki> docker version
Client: Docker Engine - Community
Cloud integration: 1.0.4
Version: 20.10.0
API version: 1.41
Go version: go1.13.15
Git commit: 7287ab3
Built: Tue Dec 8 18:55:31 2020
OS/Arch: windows/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.0
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: eeddea2
Built: Tue Dec 8 18:58:04 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
PS C:\Users\zaki> docker-compose version
docker-compose version 1.27.4, build 40524192
docker-py version: 4.3.1
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
hello world
There is also a hello world container, but it's this time of year, so let's do the following: (Please try the execution result in your environment)
docker run -it lukaszlach/merry-christmas
When you run it, you should see a nice display after the following display. (Stop Ctrl-c)
PS C:\Users\h_miyazaki> docker run -it lukaszlach/merry-christmas
Unable to find image 'lukaszlach/merry-christmas:latest' locally
latest: Pulling from lukaszlach/merry-christmas
4c288452ea93: Pull complete
Digest: sha256:00481ac02655c8e43b218abac6409c410789e7809a53a370576ef537adf46909
Status: Downloaded newer image for lukaszlach/merry-christmas:latest
Docker Compose
You can also use the docker-compose command, so I'll try this one as well.
https://github.com/weseek/growi-docker-compose
Try the GROWI Wiki (use the one provided as is in the documentation). (Bonus: Run GROWI Wiki on Kubernetes with Rook/Ceph block storage and object storage)
First, git clone the repository. If you don't have Git installed, you can download the zip.
Unzip the zip and run the docker-compose up
command in the directory containing the docker-compose.yml
file.
PS C:\Users\zaki\src> cd .\growi-docker-compose-master\
PS C:\Users\zaki\src\growi-docker-compose-master> docker-compose up
Creating network "growi-docker-compose-master_default" with the default driver
Creating volume "growi-docker-compose-master_growi_data" with default driver
Creating volume "growi-docker-compose-master_mongo_configdb" with default driver
Creating volume "growi-docker-compose-master_mongo_db" with default driver
Creating volume "growi-docker-compose-master_es_data" with default driver
Pulling mongo (mongo:4.4)...
4.4: Pulling from library/mongo
f22ccc0b8772: Pull complete
3cf8fb62ba5f: Pull complete
...
By the way, it takes some time to download multiple images and build them. At the first time, the DB is initialized after the GROWI main unit is started, so the log will flow, but
app_1 | [2020-12-19T08:55:48.455Z] INFO: growi:plugins:PluginService/77 on 0399606d9dd5: load plugin 'growi-plugin-attachment-refs'
app_1 | [2020-12-19T08:55:48.462Z] INFO: growi:plugins:PluginService/77 on 0399606d9dd5: load plugin 'growi-plugin-lsx'
app_1 | [2020-12-19T08:55:48.467Z] INFO: growi:plugins:PluginService/77 on 0399606d9dd5: load plugin 'growi-plugin-pukiwiki-like-linker'
app_1 | express-validator: requires to express-validator/check are deprecated.You should just use require("express-validator") instead.
app_1 | [2020-12-19T08:55:48.844Z] INFO: growi:crowi/77 on 0399606d9dd5: [production] Express server is listening on port 3000
If you see Express server is listening on port 3000
like this, you can access the GROWI Wiki by accessing <http: // localhost: 3000> with your browser.
After that, you can log in to the Wiki by creating an initial user, and you can use it normally by performing the initial settings (Wiki name and file upload settings). (If you select "MongoDB (GridFS)" for the file upload setting, you will be able to upload files using the internal DB.)
This also stops with Ctrl-c, but the Wiki data remains even if it stops.
If you add the option -d
and execute docker-compose up -d
, it will be executed in the background, so this may be better for normal use.
VS Code with Remote Containers
If you put VS Code and Remote Development Extension on the PC with Docker Desktop installed, you can use Remote Containers to "remotely execute VS Code on a volume-mounted container of the specified directory on Windows. You can also create a development / work environment using the Imadoki container. For example, if you press the connection icon at the bottom left, select the working directory with "Remote-Containers: Open Folder in Container ..." and select any container image such as Ubuntu, the specified directory will be in the container. You can use the Ubuntu container while it is mounted on.
The menu "View> Terminal" or Ctrl- @
will bring up the bash terminal, so if you have any additional packages you need, you can of course install them with apt
.
I installed Docker Desktop on Windows 10 Home and introduced the command line docker
and docker-compose
and VS Code's Remote Containers feature as usage examples.
Those who want to touch Docker newly but do not know how to install it, those who tried it before but gave up on Windows due to technical difficulties, now it is possible to install without any special Windows OS settings So please feel free to touch the current Docker.
Recommended Posts