Skip to content

Move an image between hosts

docker image save -o image.tar image:tag
# Copy the file
docker image load --input image.tar

Fix network not found on docker compose up

If the network changes and you try to start a container, the container fails with a message similar to the following:

ERROR: for SERVICE  Cannot start service SERVICE: Could not attach to network xq8k2g3yn3g15d1tonbmas6b4: rpc error: code = NotFound desc = network xq8k2g3yn3g15d1tonbmas6b4 not found
ERROR: for SERVICE  Cannot start service SERVICE: network eqm5t4dml9e05oqyb80lw7b7g not found

Docker compose up will create the network but the new network will have another ID and docker compose will not edit the container to use the new network. So after a docker-compose up -d you have to connect the network to the container.

So first, we make sure it was created.

docker network ls
---
NETWORK ID          NAME                     DRIVER              SCOPE
fl6dacfxefa0        NETWORK_NAME             overlay             local

And add it to the container.

docker network connect NETWORK_NAME CONTAINER_NAME

Copy a file from container to the host

docker cp <container>:/path/in/container /host/path/