Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to mount my own project to the container? #6

Closed
xieydd opened this issue Feb 26, 2020 · 7 comments
Closed

How to mount my own project to the container? #6

xieydd opened this issue Feb 26, 2020 · 7 comments

Comments

@xieydd
Copy link

xieydd commented Feb 26, 2020

I use -v ~/project:/sdcard , but when i enter, there is no sdcard in / @lukechilds
And i find in raspberrypi env, i can`t connect the internet.

@koenvervloesem
Copy link

You have to mount an image file, not a directory. For instance:

docker run -it -v ~/project/2019-09-26-raspbian-buster-lite.img:/sdcard/filesystem.img lukechilds/dockerpi:vm

@xieydd
Copy link
Author

xieydd commented Feb 26, 2020

@koenvervloesem Tnanks for your reply, i still have three question:

  1. I notice in README.md You can persist filesystem changes between reboots by mounting the /sdcard volume on your host: docker run -it -v $HOME/.dockerpi:/sdcard lukechilds/dockerpi
  2. how can i pack my file in img file?
  3. And why i can`t connect the internet.

@koenvervloesem
Copy link

  1. and 2. You have to create your own bootable image file, e.g. with pi-gen to create your own custom Raspbian derivative. I can confirm that the result boots with dockerpi.
  2. Your virtualized system has a virtual network that isn't connected to your real network by default. Have a look at Docker and qemu networking if you want to have an internet connection in your virtualized system. I haven't done this myself yet because I don't need it for my use case.

@lukechilds
Copy link
Owner

lukechilds commented Feb 27, 2020

Thanks for helping out here @koenvervloesem!

Btw, re:

  1. And why i can`t connect the internet.

You should be able to connect to the internet. Docker/QEMU networking should be working OOB.

Example:


Raspbian GNU/Linux 10 raspberrypi ttyAMA0

raspberrypi login: pi
Password:
Linux raspberrypi 4.19.50+ #1 Tue Nov 26 01:49:16 CET 2019 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

pi@raspberrypi:~$ sudo apt-get update
Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:2 http://archive.raspberrypi.org/debian buster InRelease [25.1 kB]
Get:3 http://archive.raspberrypi.org/debian buster/main armhf Packages [278 kB]
Get:4 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Fetched 13.3 MB in 50s (269 kB/s)
Reading package lists... Done
pi@raspberrypi:~$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libcurl4
The following packages will be upgraded:
  curl libcurl4
2 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.
Need to get 548 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirror1.ku.ac.th/raspbian/raspbian buster/main armhf curl armhf 7.64.0-4+deb10u1 [254 kB]
Get:2 http://mirror1.ku.ac.th/raspbian/raspbian buster/main armhf libcurl4 armhf 7.64.0-4+deb10u1 [294 kB]
Fetched 548 kB in 11s (51.5 kB/s)
Reading changelogs... Done
(Reading database ... 39798 files and directories currently installed.)
Preparing to unpack .../curl_7.64.0-4+deb10u1_armhf.deb ...
Unpacking curl (7.64.0-4+deb10u1) over (7.64.0-4) ...
Preparing to unpack .../libcurl4_7.64.0-4+deb10u1_armhf.deb ...
Unpacking libcurl4:armhf (7.64.0-4+deb10u1) over (7.64.0-4) ...
Setting up libcurl4:armhf (7.64.0-4+deb10u1) ...
Setting up curl (7.64.0-4+deb10u1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
pi@raspberrypi:~$ curl example.com
<!doctype html>
<html>
<head>
    <title>Example Domain</title>

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
    body {
        background-color: #f0f0f2;
        margin: 0;
        padding: 0;
        font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

    }
    div {
        width: 600px;
        margin: 5em auto;
        padding: 2em;
        background-color: #fdfdff;
        border-radius: 0.5em;
        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        div {
            margin: 0 auto;
            width: auto;
        }
    }
    </style>
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
    <p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

@xieydd
Copy link
Author

xieydd commented Feb 27, 2020

@lukechilds I have connect to the internet successful, and i also build a armv7 version, i notice this repo is only armv6 version.

@lukechilds
Copy link
Owner

There is currently a PR open for Pi 2/3 hardware: #4

@saiworksandbox
Copy link

As a sidenote: If you do not have internet access (on the pi container), you can fix it by editing the /etc/resolv.conf file in the pi container to reflect the same as the host (tested on Ubuntu WSL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants