OCSInventory-NG / OCSInventory-Docker-Image

Docker image for OCSInventory Server
GNU General Public License v3.0
77 stars 90 forks source link

Setup help #101

Open rhythmtone opened 1 year ago

rhythmtone commented 1 year ago

It's hard to solve a problem when important details are missing, that why we added this template, to help you and us.

General informations

Docker host's operating system : Ubuntu MATE 22.04 Mysql Server version :

Docker informations

Docker compose version : Docker version 24.0.2, build cb74dfc Docker version : Docker version 24.0.2, build cb74dfc

Problem's description

Hi, I cannot get this set up - yes, I am new to this, but the documentation is confusing - what am I doing wrong to simply build the container? I have user other Docker containers before, but something is wrong with the commands for building this specific container, and I cannot understand what, see log below, thanks!

It errors out when trying to build the container from the /latest/ directory, or from the child directory, see below.

And I do not understand the syntax of this command in the instructions either, I have tried variations of it, does not make sense. I have tried different paths and different arguments, cannot get it to work

docker build --rm -f "MY_TAG/Dockerfile" -t ocsinventory/ocsinventory-docker-image:MY_TAG "MY_TAG"

So I tried to do it from the actual /latest/ directory and also the child directory, did not work, Thanks for any help

administrator@DO-SVR-R220:~$ git clone https://github.com/OCSInventory-NG/OCSInventory-Docker-Image
Cloning into 'OCSInventory-Docker-Image'...
remote: Enumerating objects: 742, done.
remote: Counting objects: 100% (339/339), done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 742 (delta 171), reused 285 (delta 148), pack-reused 403
Receiving objects: 100% (742/742), 203.72 KiB | 2.51 MiB/s, done.
Resolving deltas: 100% (393/393), done.
administrator@DO-SVR-R220:~$ cd OCSInventory-Docker-Image/
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image$ ls
2.10  2.11  2.5  2.6  2.7  2.8  2.8.1  2.9  2.9.2  dev  latest  LICENSE  nightly  README.md  setup.sh
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image$ cd latest
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image/latest$ ls
conf  docker-compose.yml  docker-entrypoint.d  docker-entrypoint.sh  Dockerfile  nginx  sql
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image/latest$ sudo docker build - < Dockerfile
[+] Building 0.9s (14/14) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                    0.0s
 => => transferring dockerfile: 2.48kB                                                                                                                                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                                                                                                                         0.0s
 => CACHED [ 1/10] FROM docker.io/library/ubuntu:22.04                                                                                                                                                                                                                                                                  0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                         0.0s
 => CANCELED [ 2/10] RUN ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime && echo Europe/Paris > /etc/timezone                                                                                                                                                                                                   0.7s
 => CACHED [ 3/10] RUN apt-get update && apt-get install -y     wget     curl     make     perl     apache2     php     libxml-simple-perl     libdbi-perl     libdbd-mysql-perl     libapache-dbi-perl     libnet-ip-perl     libsoap-lite-perl     libarchive-zip-perl     libswitch-perl     libmojolicious-perl     0.0s
 => CACHED [ 4/10] RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.11.0/OCSNG_UNIX_SERVER-2.11.0.tar.gz -P /tmp &&     tar xzf /tmp/OCSNG_UNIX_SERVER-2.11.0.tar.gz -C /tmp;                                                                                                    0.0s
 => CACHED [ 5/10] RUN cd /tmp/OCSNG_UNIX_SERVER-2.11.0/Apache/ &&     perl Makefile.PL &&     make &&     make install                                                                                                                                                                                                 0.0s
 => CACHED [ 6/10] WORKDIR /etc/apache2/conf-available                                                                                                                                                                                                                                                                  0.0s
 => CACHED [ 7/10] RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log &&     ln -sf /proc/self/fd/2 /var/log/apache2/error.log                                                                                                                                                                                      0.0s
 => ERROR [ 8/10] COPY conf/ /tmp/conf                                                                                                                                                                                                                                                                                  0.0s
 => ERROR [ 9/10] COPY ./docker-entrypoint.sh /docker-entrypoint.sh                                                                                                                                                                                                                                                     0.0s
 => ERROR [10/10] COPY ./docker-entrypoint.d /docker-entrypoint.d                                                                                                                                                                                                                                                       0.0s
------
 > [ 8/10] COPY conf/ /tmp/conf:
------
------
 > [ 9/10] COPY ./docker-entrypoint.sh /docker-entrypoint.sh:
------
------
 > [10/10] COPY ./docker-entrypoint.d /docker-entrypoint.d:
------
Dockerfile:68
--------------------
  66 |
  67 |     COPY ./docker-entrypoint.sh /docker-entrypoint.sh
  68 | >>> COPY ./docker-entrypoint.d /docker-entrypoint.d
  69 |
  70 |     EXPOSE 80
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref f1deb7d6-46f2-494a-bdd9-1852a064839f::ph9qnp8zitp2egmqhybbrs0fk: "/docker-entrypoint.d": not found
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image/latest$ ^C
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image/latest$ cd ..
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image$ sudo docker build -f latest\Dockerfile
ERROR: "docker buildx build" requires exactly 1 argument.
See 'docker buildx build --help'.

Usage:  docker buildx build [OPTIONS] PATH | URL | -

Start a build
rhythmtone commented 1 year ago

So I got this to work with the syntax below, from the actual /latest/ folder but I still don't understand how to do it properly - could someone please explain what I am missing about the syntax?

administrator@DO-SVR-R220:~/OCSInventory-Docker-Image/latest$ sudo docker build . -t ocs:latest
[+] Building 0.1s (15/15) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                    0.0s
 => => transferring dockerfile: 2.48kB                                                                                                                                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                                                                                                                         0.0s
 => [ 1/10] FROM docker.io/library/ubuntu:22.04                                                                                                                                                                                                                                                                         0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                       0.0s
 => => transferring context: 567B                                                                                                                                                                                                                                                                                       0.0s
 => CACHED [ 2/10] RUN ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime && echo Europe/Paris > /etc/timezone                                                                                                                                                                                                     0.0s
 => CACHED [ 3/10] RUN apt-get update && apt-get install -y     wget     curl     make     perl     apache2     php     libxml-simple-perl     libdbi-perl     libdbd-mysql-perl     libapache-dbi-perl     libnet-ip-perl     libsoap-lite-perl     libarchive-zip-perl     libswitch-perl     libmojolicious-perl     0.0s
 => CACHED [ 4/10] RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.11.0/OCSNG_UNIX_SERVER-2.11.0.tar.gz -P /tmp &&     tar xzf /tmp/OCSNG_UNIX_SERVER-2.11.0.tar.gz -C /tmp;                                                                                                    0.0s
 => CACHED [ 5/10] RUN cd /tmp/OCSNG_UNIX_SERVER-2.11.0/Apache/ &&     perl Makefile.PL &&     make &&     make install                                                                                                                                                                                                 0.0s
 => CACHED [ 6/10] WORKDIR /etc/apache2/conf-available                                                                                                                                                                                                                                                                  0.0s
 => CACHED [ 7/10] RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log &&     ln -sf /proc/self/fd/2 /var/log/apache2/error.log                                                                                                                                                                                      0.0s
 => CACHED [ 8/10] COPY conf/ /tmp/conf                                                                                                                                                                                                                                                                                 0.0s
 => CACHED [ 9/10] COPY ./docker-entrypoint.sh /docker-entrypoint.sh                                                                                                                                                                                                                                                    0.0s
 => CACHED [10/10] COPY ./docker-entrypoint.d /docker-entrypoint.d                                                                                                                                                                                                                                                      0.0s
 => exporting to image                                                                                                                                                                                                                                                                                                  0.0s
 => => exporting layers                                                                                                                                                                                                                                                                                                 0.0s
 => => writing image sha256:24078b0399af1d89fa478e74209dabef8608db76eb33ecd054470cc5051b18c0                                                                                                                                                                                                                            0.0s
 => => naming to docker.io/library/ocs:latest                                                                                                                                                                                                                                                                           0.0s
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image/latest$ sudo docker images
REPOSITORY                 TAG       IMAGE ID       CREATED         SIZE
ocs                        latest    24078b0399af   2 minutes ago   550MB
oxidized/oxidized          latest    24a04441edb5   2 weeks ago     1.06GB
win10-2                    latest    fe58e8c5402b   4 weeks ago     44.5GB
vm-inst                    latest    55b2af986255   4 weeks ago     1.68GB
ubuntukvm18-04-installed   latest    3e19ae66ec0e   4 weeks ago     37.4GB
ubuntu                     22.04     08d22c0ceb15   3 months ago    77.8MB
ubuntu                     18.04     3941d3b032a8   3 months ago    63.1MB
administrator@DO-SVR-R220:~/OCSInventory-Docker-Image/latest$