2

We're going to deploy our codebase in an environment with no outbound internet access - using docker. However - we do not seem to be able to pre-build the entire thing so we don't have to pull images from any repository. The server is prepared with docker and docker-compose.

We have a docker-compose.yml file, its a lot longer that this but this is the part that we don't get to work:

 node:
    container_name: my-node
    build: ./docker/node
    volumes_from:
      - volumes_source
    ports:
      - "5000:5000"
    links:
      - mysql
      - redis

In /docker/node we have a Dockerfile:

FROM node:latest

EXPOSE 5000

RUN npm install pm2 -g

CMD ["pm2-docker", "/var/www/laravel/socket/socket.js"]

I want to pre-build this so that it wont have to run the npm install pm2 -g bit - since it wont work. What I have tried is:

  1. Booted this as a container on a internet connected host
  2. docker commit 8671bf3bd1b5 my-node:latest (8671bf3bd1b5 is container id)
  3. docker save -o my-node.docker my-node:latest
  4. docker export 8671bf3bd1b5 > my-node_latest.tar
  5. Transfered files to offline environment
  6. docker load -i my-node.docker
  7. cat my-node_latest.tar | docker import - my-node:latest
  8. Remove build: ./docker/node from docker-compose.yml in offline environment and replace with image: my-node:latest

It still tries to pull node:latest and run npm install pm2 -g though. What are we doing wrong?

chicks
  • 3,639
  • 10
  • 26
  • 36

1 Answers1

1

yes, you have exported image/container named my-node:latest. But in Dockerfile, it is built from node:latest, which you forget to export. ...

Peiming Hu
  • 111
  • 2