tandrup / docker-snmpsim

Docker image for snmpsim for SNMP simulation
15 stars 21 forks source link

Cant reproduce build of public docker image #9

Closed Axelfoley85 closed 4 years ago

Axelfoley85 commented 4 years ago

I cant reproduce the build. I also changed to python 3.4 exactly like in the Dockerfile in your public docker registry

=== Dockerfile ===

FROM python:3.4-slim

RUN pip install snmpsim

RUN adduser --system snmpsim

ADD data /usr/local/snmpsim/data

EXPOSE 161/udp

CMD snmpsimd.py --agent-udpv4-endpoint=0.0.0.0:161 --process-user=snmpsim --process-group=nogroup $EXTRA_FLAGS

=== Build+Run ===

IMAGE_NAME=snmpsim
CONTAINER_NAME=snmpsim
docker build \
    -t ${IMAGE_NAME} \
    .
docker rm -f $(docker ps -a | grep snmp | awk '{print $1}')
docker run \
    --name ${CONTAINER_NAME} \
    -v "$(pwd)/data:/usr/local/snmpsim/data" \
        -p 161:161/udp \
    ${IMAGE_NAME}

=== Log of Running dockerfile / snmpsim.py ===

6492e0d9ad80
Scanning "/root/.snmpsim/variation" directory for variation modules... 
Directory "/root/.snmpsim/variation" does not exist 
Scanning "/usr/local/snmpsim/variation" directory for variation modules... 
A total of 9 modules found in /usr/local/snmpsim/variation 
Scanning "/usr/local/share/snmpsim/variation" directory for variation modules... 
Directory "/usr/local/share/snmpsim/variation" does not exist 
Scanning "/usr/local/lib/python3.4/site-packages/snmpsim/variation" directory for variation modules... 
Directory "/usr/local/lib/python3.4/site-packages/snmpsim/variation" does not exist 
Cache directory "/tmp/snmpsim" created 
Initializing variation modules... 
ERROR Variation module "redis" from "/usr/local/snmpsim/variation/redis.py" load FAILED: Redis connect parameters not specified 
Variation module "multiplex" from "/usr/local/snmpsim/variation/multiplex.py" loaded OK 
ERROR Variation module "sql" from "/usr/local/snmpsim/variation/sql.py" load FAILED: database type not specified 
Variation module "writecache" from "/usr/local/snmpsim/variation/writecache.py" loaded OK 
Variation module "error" from "/usr/local/snmpsim/variation/error.py" loaded OK 
Variation module "subprocess" from "/usr/local/snmpsim/variation/subprocess.py" loaded OK 
Variation module "numeric" from "/usr/local/snmpsim/variation/numeric.py" loaded OK 
Variation module "notification" from "/usr/local/snmpsim/variation/notification.py" loaded OK 
Variation module "delay" from "/usr/local/snmpsim/variation/delay.py" loaded OK 
--- SNMP Engine configuration 
SNMPv3 EngineID: 0x80004fb80538386463393039346166656500070588 
  --- Data directories configuration 
  SNMPv3 Context Engine ID: 0x80004fb80538386463393039346166656500070588
  Scanning "/root/.snmpsim/data" directory for  *.MVC, *.snmpwalk, *.dump, *.sapwalk, *.snmprec data files... 
  Directory "/root/.snmpsim/data" does not exist 
  Scanning "/usr/local/snmpsim/data" directory for  *.MVC, *.snmpwalk, *.dump, *.sapwalk, *.snmprec data files... 
    Index /tmp/snmpsim/_usr_local_snmpsim_data_demo.dbm does not exist for data file /usr/local/snmpsim/data/demo.snmprec
    Building index /tmp/snmpsim/_usr_local_snmpsim_data_demo.dbm for data file /usr/local/snmpsim/data/demo.snmprec (open flags "nfu")...
    ...91 entries indexed
    Configuring /usr/local/snmpsim/data/demo.snmprec controller 
    SNMPv1/2c community name: demo 
    SNMPv3 Context Name: fe01ce2a7fbac8fafaed7c982a04e229 or demo 
  Scanning "/usr/local/share/snmpsim/data" directory for  *.MVC, *.snmpwalk, *.dump, *.sapwalk, *.snmprec data files... 
  Directory "/usr/local/share/snmpsim/data" does not exist 
  Scanning "/usr/local/lib/python3.4/site-packages/snmpsim/data" directory for  *.MVC, *.snmpwalk, *.dump, *.sapwalk, *.snmprec data files... 
  Directory "/usr/local/lib/python3.4/site-packages/snmpsim/data" does not exist 
  --- SNMPv3 USM configuration 
  SNMPv3 USM SecurityName: simulator 
  SNMPv3 USM authentication key: auctoritas, authentication protocol: MD5 
  SNMPv3 USM encryption (privacy) key: privatus, encryption protocol: DES 
  Maximum number of variable bindings in SNMP response: 64 
  --- Transport configuration 
  Listening at UDP/IPv4 endpoint 0.0.0.0:161, transport ID 1.3.6.1.6.1.1.0 
Using /usr/local/snmpsim/data/demo.snmprec controller selected by candidate b'fe01ce2a7fbac8fafaed7c982a04e229'; transport ID 1.3.6.1.6.1.1.0, source address 172.17.0.1, context name "b'fe01ce2a7fbac8fafaed7c982a04e229'" 
SNMP EngineID 0x80004fb80538386463393039346166656500070588, transportDomain (1, 3, 6, 1, 6, 1, 1, 0), transportAddress ('172.17.0.1', 36945), securityModel 2, securityName fe01ce2a7fbac8fafaed7c982a04e229, securityLevel 1 
Opening /usr/local/snmpsim/data/demo.snmprec controller 
Index /tmp/snmpsim/_usr_local_snmpsim_data_demo.dbm does not exist for data file /usr/local/snmpsim/data/demo.snmprec
ERROR Problem with data file or its index: Failed to create /tmp/snmpsim/_usr_local_snmpsim_data_demo.dbm for data file /usr/local/snmpsim/data/demo.snmprec: None

=== Running snmpwalk === will lead to the above error message snmpwalk -v2c -c demo $(docker inspect snmpsim | grep IPA | tail -n1 | cut -d\" -f 4) .

=== Additional info === The missing file actually exists in /tmp/snmp and is not empty. I also understand that you are not responsible for snmpsim.py. Though I would like to be able to reproduce the build of the image which doesn't work for me here. When I pull the image it works fine.

=== BUILD ON === ubuntu 18.04 Docker version 19.03.12, build 48a66213fe

Axelfoley85 commented 4 years ago

Using unreleased version of snmpsim from master solved this problem.

Replacing RUN pip install snmpsim with RUN pip install https://github.com/etingof/snmpsim/archive/master.zip in the Dockerfile works for this issue.

See also https://github.com/etingof/snmpsim/issues/145