Dockerizing ionic application

Hi
I am new to docker trying to learn things
here I am trying to create, build and run a sample ionic application in docker using ionic serve command


test app is the image. I have created but when I run my image getting this error

dockerfile
FROM node:12.16.3

WORKDIR Home/Documents/xxxx/ionic

//Install Ionic and Cordova
RUN npm i -g ionic cordova

//Show ionic cli command
ENTRYPOINT [“ionic”]
CMD [“serve”, “8100”]

docker-compose file
app:
build: .
ports:

  • ‘8100:8100’
  • ‘35729:35729’
    volumes:
  • .:Home/Documents/xxxx/ionic
  • Home/Documents/xxxx/ionic/node_modules
    command: ionic serve --all

I am using Ubuntu v18.04, ionic v5.4.16, and node v12.16.3

I’ll be thankful if I get the needed guidance.

The output of the docker image command shows that there is no latest tag for the testapp image.
If you build a specific tag, like you did with 1.0, the latest tag will not be created additionaly.

You will need to add the latest tag yourself:
docker tag testapp:1.0 testapp:latest

Then you should be able to run your container with either one of those tags:
sudo docker run testapp:1.0 or sudo docker run testapp:latest or sudo docker run testapp (which implicitly uses latest)

1 Like