1

I followed the next URL and successfully built a simple C++ app on Ubuntu Docker container with Visual studio 2022. Build C++ Applications in a Linux Docker Container with Visual Studio

Next, I tried using Amazon Linux 2, but the visual studio said it failed to start rsync on the remote host, so that I could not build a C++ app. I'm looking for the solutions to fix this problem.

These are my attempts.

The Dockerfile comes like this.

FROM amazonlinux:2

RUN yum -y update && yum install -y sudo passwd shadow-utils openssh-server wget tar g++ gdb ninja-build rsync zip make
RUN mkdir -p /var/run/sshd && \
    echo PasswordAuthentication yes >> /etc/ssh/sshd_config && \
    ssh-keygen -A
RUN useradd -m -d /home/master -s /bin/bash -G wheel master && echo master:pass | chpasswd

# CMake
RUN wget https://github.com/microsoft/CMake/releases/download/v3.19.4268486/cmake-3.19.4268486-MSVC_2-Linux-x64.sh && \
    chmod +x cmake-3.19.4268486-MSVC_2-Linux-x64.sh && \
    ./cmake-3.19.4268486-MSVC_2-Linux-x64.sh --skip-license --prefix=/usr

EXPOSE 22

docker build completed successfully.

docker build -t al2 -f Dockerfile.al2 .

Createing and Starting amazon linux 2 docker container completed successfully.

docker run -it -p 10022:22 --privileged al2 /sbin/init

I logged in to the docker container and started ssh service.

systemctl start sshd
systemctl enable sshd

I could login successfully with ssh from my local host.

ssh -p 10022 master@localhost

I could rsync correctly from my local wsl.

rsync -auzv test/ --rsh="ssh -p 10022" master@localhost:/home/master/test

Connection to the docker container from Visual Studio successed.

And then, I select localhost and started building C++ apps, but it stops because of the rsync issue.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.