This assumes you have installed Docker on Linux, Docker is running, and that you have initialized swarm. Let's say you have an application named "foo" built to run on docker at /tmp/foo on your Linux server running Docker. This assumes that the foo application contains Dockerfile, like this.
And Dockerfile might contain markup like this.
FROM node:6.11.5 WORKDIR /usr/src/foo COPY foo.json . RUN npm install COPY . . CMD [ "npm", "start" ]
Move into the directory that contains the app.
The docker image build command is used to create an image for the application.
docker image build -t foo:1.0 .
If all goes well, something like this should be displayed.
Successfully built 84c9fb889b5a