School of Physics, Mathematics, and Computing 
Not logged in (login)
help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!" followup message.

How do I ask a good question?
 
Options:
RSS cloud
Jump to:

lab 1

1 of 1097 articles shown, currently no other people reading this forum.
photo
From: Christopher M.
Date: Thu 5th Aug 2021, 5:45am
Actions: 
Login-to-reply

ANONYMOUS wrote:
 
> In lab 1, I have managed to get ubuntu working given the instructions on the unit 
> page, but upon attempting lab 1, I didn't really know how to access the rotate.c file 
> in the terminal. I tried copy and pasting the C code into a text editor and calling 
> the file 'rotate.c' but it is just telling me there is no such file or directory 
> restraining me to not yet start the lab. Is there something I am missing? I feel like 
> I am very close to getting it. any help would be greatly appreciated.

Hi,

This a really a more general issue about how to access your Windows or macOS files while working 
inside docker+Linux.   Until familiarity grows, you'll probably find the following way easiest, as 
it:

  - gives you the ability to read and write your local files while in docker,
  - allows you to use your standard browser to download files (such as rotate.c)
  - (assuming that you're performing backups) files created/changed in docker will be backed up.

I've tested this on macOS, but not Windows (anyone else able to test this??)

Using the Docker Desktop (GUI) we first need to indicate that docker is permitted to access your 
local files (only required once):

   - DockerDesktop > Settings(button) > Resources > FileSharing > add(+) the name of your local directory
   - Apply & Restart

(on my Mac I added /Users/chris, which is my full home directory, but you could set just a
sub-directory for specific CITS2002 work).

Now, when you run docker, we need to add some command-line arguments:

  docker run --rm -it -v /Users/chris:/home/chris -w /home/chris --name ubuntu ubuntu:latest bash

(use your name, ANONYMOUS, not chris :-)

Now, when your Linux shell starts in docker, your present working directory will be /home/chris, 
rather than the root directory,  / , a much safer place to work, and you should able to see your 
existing files using  'ls'.

_____
Hope this helps.

Related articles

lab 1 (all 12) RSS
├─ original   Wed 4th Aug 2021, 8:55pm, ANONYMOUS
├─ THIS   Thu 5th Aug 2021, 5:45am, Christopher M.
├─ reply 2   Thu 5th Aug 2021, 10:47am, ANONYMOUS  O.P.
├─ reply 3   Thu 5th Aug 2021, 2:53pm, Christopher M.
├─ reply 4   Thu 5th Aug 2021, 8:48pm, Amitava D.
├─ reply 5   Fri 6th Aug 2021, 10:55am, ANONYMOUS  O.P.
├─ reply 6   Fri 6th Aug 2021, 1:15pm, ANONYMOUS
├─ reply 7   Fri 6th Aug 2021, 2:46pm, Christopher M.
├─ reply 8   Fri 6th Aug 2021, 2:48pm, Christopher M.
├─ reply 9   Fri 6th Aug 2021, 11:20pm, Malcolm M.
├─ reply 10   Fri 6th Aug 2021, 11:22pm, Malcolm M.
└─ reply 11   Sat 7th Aug 2021, 6:35am, Christopher M.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:37am Nov 14 2021