captainVersion: 4
services:
    $$cap_appname:
        ports:
            - $$cap_sshd_port:22
        volumes:
            - $$cap_appname-data:/data
        restart: always
        environment: {}
        caproverExtra:
            dockerfileLines:
                - FROM ubuntu:16.04
                - RUN apt-get update && apt-get install -y openssh-server
                - RUN mkdir /var/run/sshd
                - RUN echo 'root:$$cap_sshd_password' | chpasswd
                - RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
                - '# SSH login fix. Otherwise user is kicked off after login'
                - RUN sed 's@sessions*requireds*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
                - ENV NOTVISIBLE "in users profile"
                - RUN echo "export VISIBLE=now" >> /etc/profile
                - EXPOSE 22
                - CMD ["/usr/sbin/sshd", "-D"]
caproverOneClickApp:
    variables:
        - id: $$cap_sshd_password
          label: Your SSH root password
          description: Enter a secure password
          defaultValue: pAsSwOrD
          validRegex: /.{8,}/
        - id: $$cap_sshd_port
          label: Your SSH exposed port
          description: Enter a port number
          defaultValue: '4646'
          validRegex: /^\d+$/
    instructions:
        start: >-
            The following app sets up an SSHd service in a container that you can use to connect to and inspect other container’s volumes, or to get quick access to a test container.



            IMPORTANT:

            This setup uses password login. You can optionally mount your keys and use public/private key to log in.
        end: >-
            The container is built and deployed. You can now connect to this container from your local machine by running the following command: 

             ssh root@IpAddressOfServer -p $$cap_sshd_port
    displayName: SSH Container
    isOfficial: true
    description: Just a simple container that has sshd installed so you can SSH directly into this container.
    documentation: 'Taken from https://docs.docker.com/engine/examples/running_ssh_service/#build-an-eg_sshd-image '
