Unable to push to local device using local base image

I am trying to push an app that uses a custom base image to a local device.

# Dockerfile
FROM sswm_main

The base image sswm_main is local to my system:

$ docker images
REPOSITORY    TAG        IMAGE ID            CREATED             SIZE
sswm_main     latest     07d2f46fa20a        About an hour ago   334MB

I am under the impression that this should work (similar to https://github.com/balena-io/balena-cli/issues/960). But when I push, I get this error:

$ sudo balena local push abcd123.local -f -s .
* Building..
- Stopping and removing any previous 'local-app' container
- Uploading build context & starting build...
Step 1/9 : FROM sswm_main
Push failed. Error: pull access denied for sswm_main, repository does not exist or may require 'balena login' Error: pull access denied for sswm_main, repository does not exist or may require 'balena login'
    at Stream.<anonymous> (/usr/local/lib/node_modules/balena-cli/node_modules/balena-sync/build/docker-utils.js:146:23)
    at Stream.emit (events.js:182:13)
    at Stream.EventEmitter.emit (domain.js:442:20)
    at drain (/usr/local/lib/node_modules/balena-cli/node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (/usr/local/lib/node_modules/balena-cli/node_modules/through/index.js:45:5)
    at Parser.parser.onToken (/usr/local/lib/node_modules/balena-cli/node_modules/JSONStream/index.js:132:18)
    at Parser.proto.write (/usr/local/lib/node_modules/balena-cli/node_modules/jsonparse/jsonparse.js:135:34)
    at Stream.<anonymous> (/usr/local/lib/node_modules/balena-cli/node_modules/JSONStream/index.js:23:12)
    at Stream.stream.write (/usr/local/lib/node_modules/balena-cli/node_modules/through/index.js:26:11)
    at IncomingMessage.ondata (_stream_readable.js:663:20)
    at IncomingMessage.emit (events.js:182:13)
    at IncomingMessage.EventEmitter.emit (domain.js:442:20)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at IncomingMessage.Readable.push (_stream_readable.js:219:10)
    at HTTPParser.parserOnBody (_http_common.js:122:22)
    at Socket.socketOnData (_http_client.js:432:20)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:442:20)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onread (net.js:638:20)

What am I doing wrong here?

Hi! The base image would need to be locally available on the device for this to work. So you would have to either push it up to a public repo on DockerHub, or save it to a tar file and load it on the device, or build it once on the device itself. The CLI doesn’t have a way to get the base image copied from your computer to the device automatically (though it does sound like something that would be nice to have).

2 Likes

Adding to what Pablo explained, you can copy the sswm_main docker image from your laptop/desktop to your device by running the following command line on your laptop/desktop:

docker save sswm_main | ssh root@abcd123.local -p 22222 balena-engine load

This works without further configuration if your device is running a development image of balenaOS. If it is running a production image, you’d need to configure ssh keys in config.json.

1 Like

Thanks.

When I run that command, I get:

sh: balena-engine: command not found

Is that because I am running an old version of ResinOS? The device is currently running: Resin OS 2.12.7+rev1

Hi,

correct, we did rename balena to balena-engine few months ago. Can you try it with balena?

HTH,
Robert

1 Like

Thanks. Since my last message, I updated to the latest Resin OS, and the command works.

Thanks everyone.

Hello pdcastro,

I use the command docker save sswm_main | ssh root@abcd123.local -p 22222 balena-engine load using my image and my credentials but after a while i take the response :
packet_write_wait: Connection to 192.168.1.100 port 22222: Broken pipe
Do you know why happens thats?

Thanks

Hello pdcastro again,

False alarm. I tried again and your command working properly. I dont know why i got that error

Thanks