Deploy nginx official image, the volumn mount incorrectly

Deploy nginx official image, the volumn can’t mount correctly. The volume named nginx-content was mounted to /etc/nginx/conf instead of /usr/share/www/html.
Any response will be appreciated.

The content of yaml file:

  • Why docker container can't create folders in mounted folders
  • docker -v and symlinks
  • Running Boot2docker behind proxy, getting FATA[0020] Forbidden for any interaction with Docker hub
  • Where is the rootfs of container in host machine after docker 1.6.0
  • Docker Expected Runs in Foreground but Runs in Background
  • Install pylint in Alpine Linux based Docker Image
  • [root@kube-master ~]# cat pv-nginx-con*
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: nginx-conf
    spec:
      capacity:
        storage: 2Gi
      accessModes:
        - ReadWriteMany
      nfs:
        server: 172.19.180.221
        path: /nginxstandlone/conf
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: nginx-content
    spec:
      capacity:
        storage: 2Gi
      accessModes:
        - ReadWriteMany
      nfs:
        server: 172.19.180.221
        path: /nginxstandlone/content
    [root@kube-master ~]# cat nginx
    nginx-php7-gwr1.0.yaml  nginx-php7.yaml         nginxstandone_one.yaml  nginxstandone.yaml      
    [root@kube-master ~]# cat nginxstandone.yaml 
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: nginx-conf
    spec:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 2Gi
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: nginx-content
    spec:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 2Gi
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: nginx-standlone
    spec:
      ports:
      - port: 8383
        targetPort: 80
        nodePort: 30065
        protocol: TCP
      selector:
        app: nginx-standlone
      type: NodePort
    ---
    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: nginx-standlone-controller
    spec:
      replicas: 1
      selector:
        app: nginx-standlone
      template:
        metadata:
          labels:
            app: nginx-standlone
        spec:
          containers:
          - name: nginx-standlone
            image: docker.io/nginx
            ports:
            - containerPort: 80
            volumeMounts:
              - name: nginx-conf
                mountPath: "/etc/nginx"
              - name: nginx-content
                mountPath: "/usr/share/nginx/html"
          volumes:
          - name: nginx-conf
            persistentVolumeClaim:
              claimName: nginx-conf
          - name: nginx-content
            persistentVolumeClaim:
              claimName: nginx-content
    [root@kube-master ~]# 
    

  • Have docker container connect to network devices
  • Docker SCRATCH container can't find files
  • How to set up container using Docker Compose to use a static IP and be accessible outside of VM host?
  • Docker exec command not using the mounted directory for /
  • docker-compose up issues on Ubuntu 14.04
  • Android build fails in Ubuntu Docker container when Gradle runs transformClasses
  • One Solution collect form web for “Deploy nginx official image, the volumn mount incorrectly”

    found the answer in slack.
    barak_a [7:20 PM]
    1. delete all of them

    [7:21]  
    2. create PV of content
    
    [7:21]  
    3. create PVC of content
    
    gwrcn [7:21 PM] 
    thanks
    
    barak_a [7:21 PM] 
    4.create PV conf
    5. create PVC conf
    
    gwrcn [7:21 PM] 
    i'll follow your guide
    
    barak_a [7:22 PM] 
    tell me if you solve it
    
    gwrcn [7:22 PM] 
    ok,i do right now
    
    gwrcn [7:31 PM] 
    it work like a charm
    
    [7:31]  
    thanks
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.