Docker Community Forums

Share and learn in the Docker community.

Image creation on server where docker is not running?


(Htyagi) #1

Hello Gurus,
I am new to docker , so posting a stupid question here.
I have a rhel 6 , where NO DOCKER is installed/running. I need to create a image from this server to include fs /app where my jboss and stuff is installed. Also i need to include /bin/ as i have installed and compiled tools like expect etc.

is it possible to create a image from tar here which include (my /app and commands) and scp this tar to the server rhel 7 where my docker is running ?
please guide me step by step if possible.


(Nickdoikov) #2

install docker on your box, build container and push it to your rhel7 server.
Docker images have only internal dependencies from base image, not to host system(except windows where docker coke are different).


(David Maze) #3

This isn’t a best practice for using Docker. A better setup is to write a Dockerfile that starts FROM centos:centos6, and then script the installation of your software.

In practice you’ll probably find some significant differences between running the overall system on bare metal or a VM and running it under Docker. As a basic example, your current system probably gets its network setup via DHCP from a physical network; under Docker the container will be assigned an IP address before it starts up. CentOS 6 doesn’t run systemd, but if it did, you’d be forced to grant the container extra privileges to start up at all.

This is a path that leads to a container that always runs a full Linux userspace stack and must run --privileged --net host; that’s going to wind up being very similar to a standard VM solution, and if that’s the path you’re headed towards, that’s a very mature and established space, and I might start there instead of using Docker.

Nevertheless, there’s a docker import command that will create an image from a complete filesystem tar file: https://docs.docker.com/engine/reference/commandline/import/