lunes, 11 de noviembre de 2024

Creating an snpashot of docker container

1 Create and modify the container:

 docker run -it ubuntu /bin/bash

# Make changes (e.g., install curl)

apt update && apt install curl -y

exit


2 Commit the container to an image:
docker commit <container_id> my_custom_ubuntu:v1

3 Save the image to a tarball:
docker save -o my_custom_ubuntu.tar my_custom_ubuntu:v1

4 Transfer the tarball to the new server:

scp my_custom_ubuntu.tar user@new_server:/path/to/destination/


5 Load the image on the new server:

docker load -i /path/to/destination/my_custom_ubuntu.tar

6  Start a new container from the image:
docker run -it my_custom_ubuntu:v1 /bin/bash

No hay comentarios:

Publicar un comentario