How to: Save/Load a custom container with SD card on PFC200

This will explain how you can save a custom docker container to an SD card, and then use that to commission a new PFC with the same container (saving time and reducing human error).

Save the image:

  1. Shell (ssh) to the controller with the running container you wish to save off. Insert a blank SD card. Ensure container does not have volumes attached for best results (docker run command did not have -v parameter used).

  2. Type:
    docker container ls
    Note the container id of the image you want to save, in this example 533ffc3cbbfe. Type:
    docker commit 533ffc3cbbfe mycontainer:v3
    Verify the image was created by typing;
    docker images
    image

  3. Save the image to a tar file to a blank SD card. Note: this can take quite some time, you might want to stop all running containers, etc… Type:
    docker save -o /media/sd/mycontainer-v3.tar mycontainer:v3
    Verify file created by typing:
    ls /media/sd/mycontainer-v3.tar

Load the image:

  1. Shell (ssh) to the controller and type;
    cd /media/sd

  2. Load the image from the SD card with the saved tar file. (in this case node-red.tar)
    docker load --input mycontainer-v3.tar

  3. Start the container with the new image: (for example)
    docker run mycontainer:v3

2 Likes