Docker Tips
Starting [edit section]
After the container is created, you should start it by running:./fuego-host-scripts/docker-start-containter.sh
This will execute the container indicated by the last_fuego_container.id (which is usually what you want)
special privileged container [edit section]
To run the container in a special privileged mode that allows access to host USB devices (needed for accessing Android targets and USB-SERIAL devices), create it instead with:./fuego-host-scripts/docker-create-usb-privileged-container.sh
To add a new device to be accessible inside the docker container, please edit the following line in docker-create-usb-privileged-container.sh:
CONTAINER_ID=`sudo docker create -it --privileged -v /dev/bus/usb:/dev/bus/usb -v /dev/ttyACM0:/dev/ttyACM0 ... --net="host" fuego`
With above, only "ttyUSBx" and "ttyACM0" will be detected and accessible inside the docker container.
NOTE: as of February, 2017, this script was in the next branch of the fuego repository.
Operations while running [edit section]
- show the running docker ID
- sudo docker ps
- execute a command in the container
- docker exec <id> <some_command>
- attach another shell inside the container
- sudo docker exec -i -t <id> bash
- access docker container using ssh
- ssh user@<ip_addr> -p 2222
- sshd is running on 2222 in the container, if the default sshd_config is used
- copy files to the container
- docker cp foo <id>:/path/to/dest
- copy files from the container
- docker cp <id>:/path/to/src/foo bar
Exiting [edit section]
To exit the docker container, just exit the primary shell that started with the container was started.
Persistence [edit section]
The Fuego container uses docker volume mounts so that some files persist in the host filesystem, even when the container is not running.In the host system, these are under fuego-ro and fuego-rw in the directory where the container was created. (This is usually in the top level of the fuego repository.)
Here are some files that persist:
- fuego-ro/boards* - for board definition files
- fuego-ro/conf/ttc.conf - for use with ttc targets
- fuego-ro/toolchains - this is where toolchains and SDKs can be installed
- fuego-ro/toolchains/tools.sh - this file has the multiplexor for the different toolchains (on the PLATFORM variable)
- fuego-rw/logs - this has logs from executed test runs
- fuego-rw/work
- fuego-rw/buildzone - this is where test programs are built
- fuego-rw/test - place where the board 'docker' places test materials
How to determine if you're inside the container [edit section]
- grep -q docker /proc/1/cgroup ; echo $?
- will be 0 if inside the container, 1 if on host
cleaning up old images [edit section]
I build lots of docker images, and they leave lots of data around.- docker ps -a - show docker containers on your system, and their images
- docker images - show images on your system, and their age and size
- docker rmi <id> - remove an image (you must remove any containers using this image first)
- docker rm <id> - remove a container