How can we access the executable .py files for edit in docker with windows?

I want to check the ROS2 nodes after installing docker in windows and using container. But I don’t know how to access to the .py files in vs code for edditing them. Before all, I don’t know where the home which the workspace “ros2_ws” is located is.

Hi @sara1627, welcome to the community!

It seems you have installed docker in your Windows system already.

Let me answer your questions in reverse order because I think that will make more sense.

You are working in creating the “ping pong” nodes, correct?

  • ros2_ws is located wherever you have cloned it, inside your docker container.

    • Check for running containers with docker ps (you should have done this already)
    • Access with docker exec -it <container_name> bash
    • Type ls, you probably cloned your work there.
    • I recommend taking our course Docker basics for robotics if you don’t have experience with it.
  • You can’t edit .py files inside a docker container with vs code. You need to be very experienced to set up vs code editing within a Docker container. If you want to edit files in a container, you can use terminal editors like vim or nano.

    • This is why you set up a repository of your work. That way, you can edit your files however you want, push them, and then, in your container, pull them.
  • To check for ROS2 nodes that are running (you have to run them first), you can just access the container like I explained above, source ROS, and list them:

docker exec -it <container_name> bash
source /opt/ros/humble/setup.bash
ros2 node list

MicroROS is quite complex, so if your goal is to build a robot, I recommend taking our course Build Your First ROS2 Robot instead.

Hi @roalgoal, thank you for your consideration and response.
Yes, I am new in working with docker.
If I understand correctly, we should clone the files in Git and push them to the container whenever we need them.
My question is originated from this issue that in section “2.4.4 Cloning your repository inside Docker” I am not able to clone the repository inside Docker container. I face this error: “Cloning into ‘microros_course_solutions’…
fatal: unable to access ‘Bitbucket’: Could not resolve host: bitbucket.org
Is it the Internet issue or something else? Can I replace another way to clone the repository? Or from other websites like Github?
Meanwhile, whenever I clone this rep into a workspace on my host computer, it is done successfully. I don’t know the reason. It shouldn’t because of an internet problem. I would be so glad if you help me to fix this issue.

[quote=“sara1627, post:3, topic:39086, full:true”]
Hi @roalgoal, thank you for your consideration and response.
Yes, I am new in working with docker.
My question is originated from this issue that in section “2.4.4 Cloning your repository inside Docker” I am not able to clone the repository inside Docker container. I face this error: “Cloning into ‘microros_course_solutions’…
fatal: unable to access ‘Bitbucket’: Could not resolve host: bitbucket.org
Is it the Internet issue or something else? Can I replace another way to clone the repository? Or from other websites like Github? Besides I can clone from other users repository in Bitbucket or Github. The error shows up just for the Theconstruct Repositories.
Meanwhile, whenever I clone this rep into a workspace on my host computer, it is done successfully. I don’t know the reason. It shouldn’t because of an internet problem. I would be so glad if you help me to fix this issue.

Hi @sara1627, it’s very strange that you can’t clone microros_course_solutions from inside the docker container but you can clone others from Bitbucket or Github.

The repository is public so you should be able to clone it with the command

git clone https://bitbucket.org/theconstructcore/microros_course_solutions.git

Please let me know if you are having issues with this, and please confirm you can clone other bitbucket repositories from inside your docker container

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.