docker example
来源:互联网 发布:超越时时彩软件 编辑:程序博客网 时间:2024/06/14 15:47
Dockerizing an SSH Daemon Service
1.dockerfile
# sshd## VERSION 0.0.1FROM ubuntu:14.04MAINTAINER Thatcher R. Peskens "thatcher@dotcloud.com"RUN apt-get update && apt-get install -y openssh-serverRUN mkdir /var/run/sshdRUN echo 'root:screencast' | chpasswdRUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_configEXPOSE 22CMD ["/usr/sbin/sshd", "-D"]
Build the image using:
$ sudo docker build -t eg_sshd .
Then run it. You can then use docker port
to find out what host portthe container's port 22 is mapped to:
$ sudo docker run -d -P --name test_sshd eg_sshd$ sudo docker port test_sshd 220.0.0.0:49154
And now you can ssh as root
on the container's IP address (you can find it with docker inspect
) or on port49154
of the Docker daemon's host IP address(ip address
orifconfig
can tell you that):
$ ssh root@192.168.1.2 -p 49154# The password is ``screencast``.$$
Finally, clean up after your test by stopping and removing thecontainer, and then removing the image.
$ sudo docker stop test_sshd$ sudo docker rm test_sshd$ sudo docker rmi eg_sshd
0 0
- docker example
- example
- example
- Example
- example
- Example
- Example
- Example
- Example
- example
- Example
- Example
- docker
- docker
- docker
- docker
- Docker
- Docker
- android_Activity的生命周期函数
- 2048 v1beta
- Largest Rectangle in Histogram
- Maximum Product Subarray
- Maximal Rectangle
- docker example
- android 调用 webservice
- Partition List
- Scramble String
- bitmap排序
- 百度2015校招笔试
- Android 数据存储方式
- 如何实现深度优先遍历(DFS)
- spring mvc之spring-ehcache缓存