Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Docker use Dockerfile created since the launch of the service support SSH container mirror     - Oracle 12c In-Memory Study (Database)

- Linux kernel network subsystem analysis (Programming)

- Windows 7 hard disk to install Ubuntu 14.10 (Linux)

- Four levels of intrusion on Linux server and counter-measures (Linux)

- CentOS 5.5 install ntop (Linux)

- Ubuntu 14.04 install Nmap 6.46.1 (Linux)

- MySQL composite partition (Database)

- Hadoop2.0 configuration yarn success (Server)

- In-depth understanding of PHP ini configuration (Server)

- Linux itself disguised illusion strengthen security (Linux)

- In addition to wget and curl, what better alternatives (Linux)

- Installation Android IDE development tools, Android Studio 1.5 under Ubuntu (Linux)

- Upgrade installation manual CentOS6.5 GCC4.8.2 (Linux)

- How do I cancel (almost) any operations in Git, (Linux)

- linux server security (Linux)

- How to install Git on CentOS 7 (Linux)

- Java JDK has been able to compile without warning (Programming)

- Ubuntu 15.10 15.04 14.10 14.04 Install Ubuntu Tweak (Linux)

- Deployment Kubernetes manage Docker example cluster on Ubuntu (Server)

- Linux group account deletion, and other related operations (Linux)

 
         
  Docker use Dockerfile created since the launch of the service support SSH container mirror
     
  Add Date : 2018-11-21      
         
       
         
  1. First create a Dockerfile file, as follows

# Select an existing image as the basis os
FROM CentOS: centos6
# Mirrored author
MAINTAINER Fanbin Kong "linuxidc@linuxidc.com"
# Sudo and install openssh-server package, and the sshd of UsePAM parameter is set to no
RUN yum install -y openssh-server sudo
RUN sed -i 's / UsePAM yes / UsePAM no / g' / etc / ssh / sshd_config
# Add a test user admin, password admin, and add the user to sudoers Lane
RUN useradd admin
RUN echo "admin: admin" | chpasswd
RUN echo "admin ALL = (ALL) ALL" >> / etc / sudoers
# Below these two rather special, in centos6 must be, or else create a container sshd can not log out
RUN ssh-keygen -t dsa -f / etc / ssh / ssh_host_dsa_key
RUN ssh-keygen -t rsa -f / etc / ssh / ssh_host_rsa_key
# Service sshd start and exposed to 22 ports
RUN mkdir / var / run / sshd
EXPOSE 22
CMD [ "/ usr / sbin / sshd", "-D"]

Dockerfile file has its own syntax and commands, specifically refer to the official documentation of Docker.

2. With Dockerfile after file, you can create image files according to Dockerfile, located in the directory Dockerfile, run the following command

sudo docker build -t centos6-ssh.

After the command is successful, it will create a name for centos6-ssh the image, you can use the "sudo docker images" to see.

3. At this point you can create your own container according to create image files out above, the following command creates a named "mytest" containers.

sudo docker run -d -P --name = mytest centos6-ssh

4. With a container, you can test our service for ssh.

4.1 run "sudo docker inspect mytest", view the current IP address of the starting container, and then run the following command to test

ssh admin @ < container IP>

4.2 In addition, can also be accessed through the port mapping docker using "sudo docker port mytest 22" view of the current container port 22 corresponding to the host machine's port, and then accessed via the following command

ssh admin @ < host machine IP> -p < port host machine>
     
         
       
         
  More:      
 
- Linux into single user mode to modify the administrator password (Linux)
- After reloading the cinder-volume OpenStack not start properly (Server)
- Linux system ARP attack solution (Linux)
- Using Linux strace command trace / debug a program commonly used options (Linux)
- To install Git on Ubuntu systems (Server)
- Use Android Studio and Gradle packaged multi-version APK (Programming)
- VNC connection VMware vSphere ESXi 5.5 (Linux)
- Ubuntu uses the / etc / profile file to configure the JAVA environment variable (Linux)
- Row-level security and application-level solutions for the new features of PostgreSQL9.5 (Database)
- RHEL5 / 6 Installation Notes (Linux)
- Fatal: unable to connect to github.com problem solving (Linux)
- MySQL log from the library than the main library (Database)
- Linux Nginx FastDFS integration module is installed Nginx and FastDFS (Server)
- Installed FFmpeg 2.6.3 on Ubuntu / Debian / Fedora system (Linux)
- Ubuntu 14.04 forget solution root password (Linux)
- SSH without password (Linux)
- Linux --- process handle limit summary (Linux)
- GAMIT 10.50 installed in Ubuntu 12.04 system (Linux)
- Linux System Getting Started Tutorial: Using the Linux common commands (Linux)
- Android using shape drawable material production (Programming)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.