Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "nanoserver" variants using "hello.txt" + powershell #24

Merged
merged 1 commit into from
Nov 18, 2016

Conversation

tianon
Copy link
Member

@tianon tianon commented Nov 17, 2016

Closes #22
Closes #23

This implements the simpler txt-file-based method @yosifkit proposed in #23 (comment) for creating nanoserver variants. 👍

@tianon
Copy link
Member Author

tianon commented Nov 17, 2016

Docker@offcl-img-test MINGW64 ~/docker/hello-world ((3f49c5b...))
$ docker build hello-world/nanoserver
Sending build context to Docker daemon 3.584 kB
Step 1/3 : FROM microsoft/nanoserver
 ---> 787d9f9f8804
Step 2/3 : COPY hello.txt C:
 ---> 69b09b634328
Removing intermediate container 094565fb6465
Step 3/3 : CMD powershell -Command Get-Content C:\hello.txt
 ---> Running in c4c94d71997e
 ---> cabbfcafaf4c
Removing intermediate container c4c94d71997e
Successfully built cabbfcafaf4c

Docker@offcl-img-test MINGW64 ~/docker/hello-world ((3f49c5b...))
$ docker run --rm cabbfcafaf4c

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.
 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 a Nano Server container with:
 $ docker run -it microsoft/nanoserver powershell

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

@thecloudtaylor
Copy link

I believe you could even simplify the nano example further with "type hello.txt" :).

@tianon
Copy link
Member Author

tianon commented Nov 17, 2016

@taylorb-microsoft heh, true -- although that's cmd and powershell is "The Future", right? 😇

@yosifkit
Copy link
Member

This looks fine to me!

@thecloudtaylor
Copy link

I'm all about using the smallest tool that fixes the job :)... PowerShell still takes an extra few ms to start beyond CMD...

@friism
Copy link

friism commented Nov 18, 2016

haha, this is cheating :-)

@tianon
Copy link
Member Author

tianon commented Nov 18, 2016

@taylorb-microsoft yeah, fair -- I did some benchmarking to test:

  • CMD ["cmd", "/C", "type C:\\hello.txt"]
real    0m5.321s
real    0m4.422s
real    0m4.858s
real    0m5.800s
  • CMD ["powershell", "-Command", "Get-Content C:\\hello.txt"]
real    0m8.941s
real    0m8.867s
real    0m9.070s
real    0m8.565s

So, uh, that result is pretty clear. I'm going to update this PR. 👍

@tianon
Copy link
Member Author

tianon commented Nov 18, 2016

Updated!

@yosifkit yosifkit merged commit aa875b2 into docker-library:master Nov 18, 2016
@yosifkit yosifkit deleted the windows branch November 18, 2016 17:58
@tianon
Copy link
Member Author

tianon commented Nov 18, 2016

@yosifkit made a good point in passing that helps rationalize this a little better -- if we decided to make the Linux variants FROM alpine, we'd be using cat instead of a binary there too 😄

tianon added a commit to infosiftr/stackbrew that referenced this pull request Nov 21, 2016
- `haproxy`: 1.6.10
- `hello-seattle`: add `nanoserver` variant (docker-library/hello-world#24)
- `hello-world`: add `nanoserver` variant (docker-library/hello-world#24)
- `hola-mundo`: add `nanoserver` variant (docker-library/hello-world#24)
- `percona`: 5.5.53-rel38.4-1.jessie
- `ruby`: 2.3.3
@friism
Copy link

friism commented Jan 20, 2017

@tianon is there any hope of making this a multi-arch image with a fat manifest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants