QT-DevOps / DevOpsIssues

This Repo will be used to demonstrate the Skills & Questions in DevOps
Apache License 2.0
27 stars 130 forks source link

unable to build docker-compose.yml file #1001

Closed amit2793 closed 3 years ago

amit2793 commented 3 years ago

I am trying to create container with ssh service and I have successfully created a dockerfile with following code:

FROM centos RUN yum -y install openssh-server RUN useradd remote_user && \ echo "1234" | passwd remote_user --stdin && \ mkdir /home/remote_user/.ssh && \ chmod 700 /home/remote_user/.ssh COPY remote-key.pub /home/remote_user/.ssh/authorized_keys RUN chown remote_user:remote_user -R /home/remote_user/.ssh/ && \ chmod 600 /home/remote_user/.ssh/authorized_keys RUN /usr/sbin/sshd-keygen CMD /usr/sbin/sshd -D

Docker-compose.yml code:

version: '3' services: jenkins: container_name: jenkins image: jenkins/jenkins ports:

ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "./docker-compose.yml", line 5, column 12

Please help me in resolving this issue. Appreciate your help!!!

@shaikkhajaibrahim santhoshd402

amit2793 commented 3 years ago

i was able to fix the above error however , now i am getting following error

[jenkins@localhost jenkins-data]$ docker-compose build ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType.

Note: code is same

santhoshd402 commented 3 years ago

Please provide service type... Which type you want it

santhoshd402 commented 3 years ago

Also refer here https://docs.docker.com/compose/

amit2793 commented 3 years ago

Please provide service type... Which type you want it

Thank you for your response.This code was working fine previously, the issue started only after entering the following code.

remote_host: container_name: remote-host image: remote-host build: context: centos7 networks:

With the help of above code what i am trying to achieve is to create a docker Machine with ssh service.

amit2793 commented 3 years ago

Also, could you please let me know what service type need to be given?

santhoshd402 commented 3 years ago

Please check the docs you will get more info...

amit2793 commented 3 years ago

it was issue an with indentation and spaces given while creating docker-compose.yml