IT之家4月19日消息 Ubuntu 20.04 LTS on Windows 已经上架 Microsoft Store 应用商店,Ubuntu 20.04 on Windows允许使用Ubuntu Terminal并运行Ubuntu命令行实用程序,包括bash,ssh,git,apt等。请注意,Windows 10 S不支持运行此应用程序。
Ubuntu 20.04 LTS on Windows需要Windows 10 版本 16215.0 或更高版本,支持ARM64、x64体系结构。
据IT之家了解,要启动Ubuntu 20.04 on Windows,请在命令行提示符(cmd.exe)上使用“ ubuntu2004”,或在“开始”菜单中单击Ubuntu磁贴。
要使用此功能,首先需要使用“打开或关闭Windows功能”并选择“Windows Subsystem for Linux”,单击“确定”,重新启动,然后使用此应用程序。
root@docker-test:~#
docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest:
sha256:fc6a51919cfeb2e6763f62b6d9e8815acbf7cd2e476ea353743570610737b752
Status: Downloaded newer image for hello-world:latest
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/
root@docker-test:~#
當你行 docker run hello-world
它會自動上到 “倉庫” 找 “hello-world” 這個影像檔然後執行
之後我們再試下 ubuntu shell 看看
docker run -it ubuntu bash
root@docker-test:~#
docker run -it ubuntu bash
Unable to find image ‘ubuntu:latest’ locally
latest: Pulling from library/ubuntu
423ae2b273f4: Pull complete
de83a2304fa1: Pull complete
f9a83bce3af0: Pull complete
b6b53be908de: Pull complete
Digest:
sha256:04d48df82c938587820d7b6006f5071dbbffceb7ca01d2814f81857c631d44df
Status: Downloaded newer image for ubuntu:latest
root@7b55e3f631cd:/#
root@docker-test:~#
docker run -d –name=apache2 httpd
2d40f50299972e46392d10b9ecf8afbbe3189cace34aaadede7d1e372509b667
已經生成了一個基於 httpd image 的容器 “–name” 給予這個容器一個別名
當前有多少容器在運行 command : “dcoker ps -a”
root@docker-test:~#
docker ps -a
CONTAINER
ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d40f5029997 httpd “httpd-foreground” 13 minutes
ago Up 13
minutes 80/tcp apache2
7b55e3f631cd ubuntu “bash” 58 minutes ago Exited
(127) 52 minutes
ago elastic_morse
a8560ebcedb9 hello-world “/hello” About an hour ago Exited (0)
About an hour
ago distracted_dubinsky
你們可以看到 status 只有 apache2 在背環繼續執行 , 因為我創造apache容器時加了 “-d” daemon
要停止那些容器 command : docker stop apache2
root@docker-test:~#
docker stop apache2
apache2
root@docker-test:~# docker ps -a
CONTAINER
ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d40f5029997 httpd “httpd-foreground” 20 minutes
ago Exited (0)
5 seconds
ago apache2
7b55e3f631cd ubuntu “bash” About an hour ago Exited
(127) About an hour
ago elastic_morse
a8560ebcedb9 hello-world “/hello” About an hour ago Exited (0)
About an hour
ago distracted_dubinsky
root@docker-test:~#
docker start apache2
apache2
root@docker-test:~# docker ps -a
CONTAINER
ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d40f5029997 httpd “httpd-foreground” 23 minutes
ago Up 2
seconds 80/tcp apache2
7b55e3f631cd ubuntu “bash” About an hour ago Exited
(127) About an hour
ago elastic_morse
a8560ebcedb9 hello-world “/hello” About an hour ago Exited (0)
About an hour
ago distracted_dubinsky
root@docker-test:~#
docker rm apache2
Error response from daemon:
You cannot remove a running container
2d40f50299972e46392d10b9ecf8afbbe3189cace34aaadede7d1e372509b667. Stop
the container before attempting removal or force remove
root@docker-test:~# docker stop apache2
apache2
root@docker-test:~# docker rm apache2
apache2
root@docker-test:~# docker ps -a
CONTAINER
ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b55e3f631cd ubuntu “bash” About an hour ago Exited
(127) About an hour
ago elastic_morse
a8560ebcedb9 hello-world “/hello” About an hour ago Exited (0)
About an hour
ago distracted_dubinsky
root@docker-test:~#
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.