-1
Hi all,
I spent a whole lot of time today inside a docker container, installing software and making changes to the environment, setting everything up the way I need it.

Then I realized none of that has been retained. Here is exactly what I have done:

    create directory
    shell script template docker_run.sh and paste the template
    modify to use the right tag: CONTAINER_IMAGE=“dustynv/ros:galactic-pytorch-l4t-r32.7.1”
    save and make it executable: chmod 755 docker_run.sh
    run it ./docker_run.sh

Upon execution I get the following output:
xhost:  unable to open display ""
xauth:  file /home/administrator/.Xauthority does not exist
xauth: (argv):1:  unable to read any entries from file "(stdin)"

running 5. above with sudo does not change anything either. Did some search on google, but only got me more confused:

Seems like I have to commit changes made to the docker container, but even after reading for a solid two hours and following some other tutorials, I’m still not sure how I can commit changes to the docker container. And if that needs to be done from within or outside,…

As above stated, I used a docker image from here: Github

ros:galactic-pytorch-l4t-r32.7.1

Please let me know how I can retain my changes, so I don’t have to re-do the entire setup everytime :-/

Thanks team

  • A Docker container is intrinsically a temporary environment, and the container filesystem will always be deleted when the container exits. If you "spend time inside a Docker container installing software", you _will_ lose work. – David Maze Dec 21 '22 at 11:35

1 Answers1

0

You need to use the docker image that you want to build (install software on) as the base docker image and write your own Dockerfile for the changes to persist.

Example:

FROM ubuntu:latest // Base image
RUN apt-get update && apt-get install python3 // Software installation
Abhishek S
  • 546
  • 3
  • 16
  • Nah, I downloaded a docker image from the github page, that shouldn't require any "building" or further software installs, as it is pre-compiled environment for ROS. Unless I completely misunderstand how this is supposed to work – Aotearoa_DEV Dec 21 '22 at 08:00
  • The problem also seems to be that once I exit the docker, it wont show as a running container using "sudo docker ps -a" There is simply no more running docker container, so using commit and the docker_process_id won't work...... – Aotearoa_DEV Dec 21 '22 at 08:08
  • ```installing software and making changes to the environment, setting everything up the way I need it.``` What was done here? What command was used to run the docker? does the `docker ps -a` show the docker in stopped state at least? – Abhishek S Dec 21 '22 at 08:19
  • All mentioned in original post! 1. create directory 2. get shell script docker_run.sh (from dusty-nv / jetson-containers) 3. modify to use the right tag: CONTAINER_IMAGE=“dustynv/ros:galactic-pytorch-l4t-r32.7.1” 4. save and make it executable: chmod 755 docker_run.sh 5. run it ./docker_run.sh – Aotearoa_DEV Dec 21 '22 at 08:35
  • @Aotearoa_DEV I'm not sure why you're disagreeing here. This is exactly how a docker container is meant to work. And creating your own dockerfile is a fine solution here, it doesn't matter than it's using the ros image as a base. – BTables Dec 21 '22 at 16:33
  • I don't understand. Let's say I have this example dustynv/ros:galactic-pytorch-l4t-r32.7.1 what are the commands to install microRos in it? I'm entirely confused by the workflow, I need to be able to make changes and ensure the changes inside the container or images (whichever) are retained. so I can continue to work on the next day, where I left of. Would you kindly list instructions (given above image/tag) how to enter, make a change (textfile), exit and ensure it is retained, PLEASE? – Aotearoa_DEV Dec 22 '22 at 19:58
  • @Aotearoa_DEV You’re never going to make changes inside a container, close the container, and have them retained. This isn’t how docker is supposed to work. Because you should use a Dockerfile to copy files/folders from the host system. What host system are you running on so I can try to give an example? – BTables Dec 23 '22 at 17:55