Skip to content

Instantly share code, notes, and snippets.

@npiper
Last active October 13, 2017 17:56
Show Gist options
  • Save npiper/9e9c9c03923c420b5a749c3be135dc49 to your computer and use it in GitHub Desktop.
Save npiper/9e9c9c03923c420b5a749c3be135dc49 to your computer and use it in GitHub Desktop.
How to create an SFTP server in Openshift

How to create an SFTP Docker image in Openshift

Configure Openshift to allow containers to run as root

Good for demo's, not good for prod.

oc adm policy add-scc-to-user anyuid -z default

new-app Docker image

Basing the image off the docker hub sftp image at atomz/sftp

oc new-app atmoz/sftp

Deployment config

Edit the .yaml to add an argument:

   spec:
      containers:
        - name: sftp
          image: >-
            atmoz/sftp@sha256:71702a0415bc123a8ba8fc07711c898ead03aa4dbb21ca4fcab2f64f5e753f5e
          args:
            - 'foo:pass:1001'
          ports:
            - containerPort: 22
              protocol: TCP

Storage

Should have persistent storage.. TO DO

Configuring a non Web App port (TCP)

Non-cloud Service

oc create -f sftp-service.yaml

sftp-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: sftp-ingress
spec:
  ports:
  - name: sftp
    port: 2222
  type: LoadBalancer
  selector:
    name: sftp

References

https://docs.openshift.com/enterprise/3.2/dev_guide/deployments.html#executing-commands-inside-a-container-deployments

https://blog.openshift.com/getting-any-docker-image-running-in-your-own-openshift-cluster/

https://docs.openshift.com/container-platform/3.3/dev_guide/getting_traffic_into_cluster.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment