Charles Michel
Charles Michel

Reputation: 304

How to deploy docker image to another Ubuntu system

I am new to docker. i am a python developer recently i got a task to packaging my django project and deploy it on another ubuntu. so i planned to save django project as docker image and load it into another ubuntu system. i saved the docker image sudo docker save -o /home/charles/Desktop/dockerdemo4_web.tar dockerdemo4_web by this command and loaded it with sudo docker load -i dockerdemo4_web.tar after that i seen the docker image listed by sudo docker images but there is no container listed.
i dont know what to do now. let me know how to run my docker image(django project) to execute my django application as i did on source machine(sudo docker-compose up)

Upvotes: 0

Views: 322

Answers (3)

Nikita Kalitin
Nikita Kalitin

Reputation: 183

Also I advise you to look at the section of the file docker-compose.yml

for example: docker-compose.yml

version: '3'
services:
   web:
     build:.
     ports:
      - "3001: 80"
   db:
     image: mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: example

   adminer:
     image: admin
     restart: always
     ports:
       - 8080: 8080`

Here is interesting section "web". There is a build on the Dockerfile in the current directory. You can also add your images, including the one that was obtained with the help of "save / load"

Upvotes: 0

Nikita Kalitin
Nikita Kalitin

Reputation: 183

May be this help you:

docker run --name app-container -p 8080:80 -it yours-image:latest /bin/bash

and check running containers

docker ps -a

Upvotes: 1

fly2matrix
fly2matrix

Reputation: 2477

Docker image is just a template that is used to create runtime environment (container).

So if you can see docker image on the target environment then with correct docker run command you can create+start the container.

#>docker run --name friendly-name docker-image-name

docker-compose up will work if target environment machine has this utility installed and
it looks for docker-compose.yml(default) file to help you in running the container.

Upvotes: 0

Related Questions