Docker Compose: Use static and dynamic network interface in container - linux

I have an app that needs to access the internet and a local resource in a local area network. I want to run this app with docker compose. My host-system has 4 physical network ports and I connect with two Ethernet cables to the local-area net and the internet.
Host system can ping addresses from both networks successfully. But from inside the container I get no ping to outside. Tried with ping, tried a specific port with nmap, to no avail.
I have the following output when I analyze the network interfaces:
# network configuration host-system
enp03s31f6:
IPv4: XXX.XXX.XXX.XX
IPv6: XXXX:XXXX:XXXX:XXXX
enp2s0:
IPv4: 192.168.163.222 # <- host computer's address in local network
IPv6: XXXX:XXXX:XXXX:XXXX <- somehow an IPv6 address is assigned but only IPv4 is relevant
My docker-compose.yml is posted below:
# docker-compose.yml
version: "3.6"
networks:
dhcp_net:
app_local_net:
driver_opts:
com.docker.network.bridge.host_binding_ipv4: "192.168.163.222"
ipam:
driver: default
config:
- subnet: "192.168.163.0/24"
services:
main:
build:
context: .
image: "my_custom_app"
ports:
- "192.168.163.222:520:520"
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
networks:
dhcp_net:
app_local_net:
ipv4_address: 192.168.163.222
command: ./start_my_app
Of course there are more services in the compose-file, I left them out for better focus.
when I go into the container while it is running, I can successfully install iputils-ping and ping internet addresses. When I try to ping an address in the local network (app_local_net), host is unreachable.
When I go and inspect the container's network, following output is generated:
docker network inspect my_app_app_local_net
[
{
"Name": "my_app_app_local_net",
"Id": "b43184e60537541a764c3479ece9e861c49169b7629f810f532276b9949b522f",
"Created": "2021-11-17T17:37:50.935949741+01:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.163.0/24"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"e3ae8336c0ac18f7d164a15bd9e7f590ffa18b8b1688900a7ad639f92ba7bcf2": {
"Name": "my_app_main_1",
"EndpointID": "4d2fa1e37a823144fe1ffd3ea4f0720d8be83d4fc17629d5921cbd781e775838",
"MacAddress": "02:42:c0:a8:a3:de",
"IPv4Address": "192.168.163.222/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.host_binding_ipv4": "192.168.163.222"
},
"Labels": {
"com.docker.compose.network": "app_local_net",
"com.docker.compose.project": "my_app",
"com.docker.compose.version": "1.29.2"
}
}
]
ifconfig shows the following:
root#container$:ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.21.0.2 netmask 255.255.0.0 broadcast 172.21.255.255
ether 02:42:ac:15:00:02 txqueuelen 0 (Ethernet)
RX packets 1132 bytes 1641413 (1.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 870 bytes 60160 (60.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.163.222 netmask 255.255.255.0 broadcast 192.168.163.255
ether 02:42:c0:a8:a3:de txqueuelen 0 (Ethernet)
RX packets 59 bytes 7508 (7.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 252 (252.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 188.10.163.4 netmask 255.255.255.0 broadcast 188.10.163.255
ether 02:42:bc:0a:a3:04 txqueuelen 0 (Ethernet)
RX packets 25 bytes 2975 (2.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 16 bytes 1716 (1.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16 bytes 1716 (1.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
if I do a $ ping -I eth1 192.168.163.102 inside the container, it will not work.
I see the following questions as related and already incorporated advice, but somehow I am stuck:
Docker compose yml static IP addressing
How can I make docker-compose bind the containers only on defined network instead of 0.0.0.0?
Docker Compose with static public IP over LAN but different with Host IP
Provide static IP to docker containers via docker-compose
Is there anything I am missing? Thanks for any help in advance :-)

Related

Increasing initrd.gz size prevents kernel from booting

I have an ARM based embedded system with 1GB of memory. The kernel, dtb file and root filesystem (initrd.gz) are stored in a FIT file in flash. U-boot loads the FIT into ram and boots the kernel.
I'm having a problem where if I slightly increase the size of my root file system my system no longer boots and I can't figure out where I'm exceeding a memory boundary.
This configuration works (initrd.gz size ~30MB) u-boot output:
Booting using the fdt blob at 0x20683744
Loading Kernel Image ... OK
Loading Ramdisk to 8e1d0000, end 8ffffebd ... OK
Loading Device Tree to 8e1bf000, end 8e1cf118 ... OK
Kernel output:
[ 2.761235] RAMDISK: gzip image found at block 0
[ 5.345119] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
After increasing the size of initrd.gz this configuration doesn't work (initrd.gz size ~35MB):
Booting using the fdt blob at 0x20683744
Loading Kernel Image ... OK
Loading Ramdisk to 8dfc1000, end 8ffff795 ... OK
Loading Device Tree to 8dfb0000, end 8dfc0118 ... OK
This is the Kernel error I get when trying to use the larger initrd.gz:
[ 2.781244] RAMDISK: gzip image found at block 0
[ 5.731423] RAMDISK: EOF while reading compressed data
[ 5.739401] uncompression error
[ 6.192160] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
[ 6.200144] VFS: Mounted root (ext4 filesystem) on device 1:0.
[ 6.207089] EXT4-fs error (device ram0): ext4_lookup:1576: inode #2: comm swapper/0: deleted inode referenced: 64974
[ 6.218882] EXT4-fs (ram0): Remounting filesystem read-only
[ 6.225112] devtmpfs: error mounting -117
I have 1GB of ram starting at 0x80000000 and U-boot detects the right amount of memory:
DRAM: already initialized, 1 GiB (capacity:1024 MiB, VGA:0 MiB), ECC off
Kenel config of ramdisk size:
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=1
CONFIG_BLK_DEV_RAM_SIZE=256000
Full U-boot and Kernel Log:
U-Boot SPL 2019.04 (Nov 24 2021 - 18:02:33 +0000)
Trying to boot from RAM
U-Boot 2019.04 (Nov 24 2021 - 18:02:33 +0000)
UnKnow-SOC: 5010203
RST: Power On
eSPI Mode: SIO:Enable : SuperIO-2e
Eth: MAC0: RMII/NCSI, MAC1: RMII/NCSI, MAC2: RMII/NCSI, MAC3: RMII/NCSI
Model: Aspeed BMC
DRAM: already initialized, 1 GiB (capacity:1024 MiB, VGA:0 MiB), ECC off
PCIE-0: Link down
MMC:
sdhci_slot0#100: 1, emmc_slot0#100: 0
Loading Environment from SPI Flash... SF: Detected mt25ql02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
*** Warning - bad CRC, using default environment
In: serial#1e784000
Out: serial#1e784000
Err: serial#1e784000
Model: Aspeed BMC
adc 15 value = 0x385
board_rev: 3
Net:
Warning: ftgmac#1e660000 (eth0) using random MAC address - 12:2c:e3:e4:22:c7
eth0: ftgmac#1e660000
Warning: ftgmac#1e680000 (eth1) using random MAC address - fa:38:94:5e:b7:43
, eth1: ftgmac#1e680000
Hit any key to stop autoboot: 0
## Loading kernel from FIT Image at 20100000 ...
Using 'conf-1' configuration
Trying 'kernel-1' kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: uncompressed
Data Start: 0x201000cc
Data Size: 5780952 Bytes = 5.5 MiB
Architecture: ARM
OS: Linux
Load Address: 0x80008000
Entry Point: 0x80008000
Verifying Hash Integrity ... OK
## Loading ramdisk from FIT Image at 20100000 ...
Using 'conf-1' configuration
Trying 'ramdisk-1' ramdisk subimage
Description: RAMDISK
Type: RAMDisk Image
Compression: uncompressed
Data Start: 0x206908e0
Data Size: 35515536 Bytes = 33.9 MiB
Architecture: ARM
OS: Linux
Load Address: unavailable
Entry Point: unavailable
Verifying Hash Integrity ... OK
## Loading fdt from FIT Image at 20100000 ...
Using 'conf-1' configuration
Trying 'fdt-1' fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x20683754
Data Size: 53529 Bytes = 52.3 KiB
Architecture: ARM
Verifying Hash Integrity ... OK
Booting using the fdt blob at 0x20683754
Loading Kernel Image ... OK
Loading Ramdisk to 8de21000, end 8ffffc90 ... OK
Loading Device Tree to 8de10000, end 8de20118 ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0xf00
[ 0.000000] Linux version 5.1.3 (aaron#aaron-VirtualBox) (gcc version 9.2.0 (GCC)) #20 SMP Wed Jan 5 14:22:25 CST 2022
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: AST2620 PSC
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 16 MiB at 0xbf000000
[ 0.000000] random: get_random_bytes called from start_kernel+0x9c/0x4e0 with crng_init=0
[ 0.000000] percpu: Embedded 17 pages/cpu s39820 r8192 d21620 u69632
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 243712
[ 0.000000] Kernel command line: console=ttyS4,115200n8 root=/dev/ram rw
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 911132K/983040K available (8192K kernel code, 512K rwdata, 1892K rodata, 1024K init, 194K bss, 55524K reserved, 16384K cma-reserved)
[ 0.000000] ftrace: allocating 28861 entries in 57 pages
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] scu-irq controller registered, irq 17
[ 0.000000] scu-irq controller registered, irq 18
[ 0.000000] arch_timer: cp15 timer(s) running at 1200.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x114c1bbbeec, max_idle_ns: 440795229572 ns
[ 0.000006] sched_clock: 56 bits at 1200MHz, resolution 0ns, wraps every 2199023255551ns
[ 0.000015] Switching to timer-based delay loop, resolution 0ns
[ 0.001364] Calibrating delay loop (skipped), value calculated using timer frequency.. 2400.00 BogoMIPS (lpj=12000000)
[ 0.001381] pid_max: default: 32768 minimum: 301
[ 0.001584] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.001598] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.002112] *** VALIDATE proc ***
[ 0.002213] *** VALIDATE cgroup1 ***
[ 0.002224] *** VALIDATE cgroup2 ***
[ 0.002234] CPU: Testing write buffer coherency: ok
[ 0.002522] /cpus/cpu#0 missing clock-frequency property
[ 0.002538] /cpus/cpu#1 missing clock-frequency property
[ 0.002549] CPU0: thread -1, cpu 0, socket 15, mpidr 80000f00
[ 0.003326] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.003436] rcu: Hierarchical SRCU implementation.
[ 0.004015] smp: Bringing up secondary CPUs ...
[ 0.004543] CPU1: thread -1, cpu 1, socket 15, mpidr 80000f01
[ 0.004678] smp: Brought up 1 node, 2 CPUs
[ 0.004690] SMP: Total of 2 processors activated (4800.00 BogoMIPS).
[ 0.004695] CPU: All CPU(s) started in SVC mode.
[ 0.005462] devtmpfs: initialized
[ 0.015183] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.015413] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.015436] futex hash table entries: 512 (order: 3, 32768 bytes)
[ 0.016155] pinctrl core: initialized pinctrl subsystem
[ 0.016780] NET: Registered protocol family 16
[ 0.017796] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.019143] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.019159] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.034904] i2cg - base_clk0 : 1000000
[ 0.034974] i2cg - base_clk1 : 4000000
[ 0.035007] i2cg - base_clk2 : 10000000
[ 0.035030] i2cg - base_clk3 : 33333333
[ 0.035059] i2c global registered
[ 0.052820] vgaarb: loaded
[ 0.053173] SCSI subsystem initialized
[ 0.053462] usbcore: registered new interface driver usbfs
[ 0.053527] usbcore: registered new interface driver hub
[ 0.053629] usbcore: registered new device driver usb
[ 0.053777] EDAC MC: Ver: 3.0.0
[ 0.056747] clocksource: Switched to clocksource arch_sys_counter
[ 0.102558] NET: Registered protocol family 2
[ 0.103052] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
[ 0.103077] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.103136] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.103232] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.103337] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.103383] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.103595] NET: Registered protocol family 1
[ 0.104121] RPC: Registered named UNIX socket transport module.
[ 0.104133] RPC: Registered udp transport module.
[ 0.104138] RPC: Registered tcp transport module.
[ 0.104142] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.104365] Trying to unpack rootfs image as initramfs...
[ 0.104959] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 0.230086] Freeing initrd memory: 34684K
[ 0.232404] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[ 0.232955] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.233298] jffs2: version 2.2. (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.238540] NET: Registered protocol family 38
[ 0.238631] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 0.240354] PCIE- Link down
[ 0.240394] aspeed-pcie 1e6ed200.pcie: host bridge /ahb/apb/pcie#1e6ed2000 ranges:
[ 0.240439] aspeed-pcie 1e6ed200.pcie: IO 0x00010000..0x0001ffff -> 0x00010000
[ 0.240463] aspeed-pcie 1e6ed200.pcie: MEM 0x70000000..0x7ffffffe -> 0x70000000
[ 0.240601] aspeed-pcie 1e6ed200.pcie: PCI host bridge to bus 0000:00
[ 0.240615] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 0.240625] pci_bus 0000:00: root bus resource [io 0x0000-0xffff] (bus address [0x10000-0x1ffff])
[ 0.240634] pci_bus 0000:00: root bus resource [mem 0x70000000-0x7ffffffe]
[ 0.244693] PCI: bus0: Fast back to back transfers disabled
[ 0.246332] aspeed-kcs-bmc: channel=1 addr=0xca0 idr=0x24 odr=0x30 str=0x3c
[ 0.247024] aspeed-kcs-bmc: channel=2 addr=0xca8 idr=0x28 odr=0x34 str=0x40
[ 0.247519] aspeed-kcs-bmc: channel=3 addr=0xca2 idr=0x2c odr=0x38 str=0x44
[ 0.249831] aspeed_jtag: driver successfully loaded.
[ 0.250549] aspeed_mctp: reset.
[ 0.251512] aspeed_mctp: driver successfully loaded.
[ 0.251843] aspeed_mctp 1e6f9000.mctp: no irq specified
[ 0.251924] aspeed_mctp: reset.
[ 0.252556] aspeed_mctp: driver successfully loaded.
[ 0.253971] Serial: 8250/16550 driver, 17 ports, IRQ sharing enabled
[ 0.259918] rts_gpio: 912
[ 0.260616] 1e783000.serial: ttyS0 at MMIO 0x1e783000 (irq = 55, base_baud = 115384) is a 16550A
[ 0.261593] 1e784000.serial: ttyS4 at MMIO 0x1e784000 (irq = 56, base_baud = 115384) is a 16550A
[ 0.963132] printk: console [ttyS4] enabled
[ 0.968571] rts_gpio: 913
[ 0.971997] 1e78d000.serial: ttyS1 at MMIO 0x1e78d000 (irq = 64, base_baud = 115384) is a 16550A
[ 0.982439] rts_gpio: 914
[ 0.985636] 1e78e000.serial: ttyS2 at MMIO 0x1e78e000 (irq = 65, base_baud = 115384) is a 16550A
[ 0.996096] rts_gpio: 984
[ 0.999323] 1e790000.serial: ttyS5 at MMIO 0x1e790000 (irq = 74, base_baud = 115384) is a 16550A
[ 1.009701] rts_gpio: 985
[ 1.012888] 1e790100.serial: ttyS6 at MMIO 0x1e790100 (irq = 75, base_baud = 115384) is a 16550A
[ 1.023277] rts_gpio: 986
[ 1.026465] 1e790200.serial: ttyS7 at MMIO 0x1e790200 (irq = 76, base_baud = 115384) is a 16550A
[ 1.036908] rts_gpio: 987
[ 1.040107] 1e790300.serial: ttyS8 at MMIO 0x1e790300 (irq = 77, base_baud = 115384) is a 16550A
[ 1.066850] timeriomem_rng 1e6e2524.hwrng: 32bits from 0x(ptrval) # 1us
[ 1.075683] brd: module loaded
[ 1.085457] loop: module loaded
[ 1.102789] aspeed_espi: driver successfully loaded.
[ 1.109342] aspeed espi oob loaded
[ 1.114069] aspeed espi-flash loaded
[ 1.118894] aspeed espi-vw loaded
[ 1.123077] no host mapping address
[ 1.127638] aspeed espi-peripheral loaded
[ 1.133917] Uniform Multi-Platform E-IDE driver
[ 1.139157] ide-gd driver 1.18
[ 1.143380] aspeed-smc 1e620000.spi: bus_width 4, Using 50 MHz SPI frequency
[ 1.151375] aspeed-smc 1e620000.spi: mt25ql02g (262144 Kbytes)
[ 1.157905] aspeed-smc 1e620000.spi: CE0 window [ 0x20000000 - 0x30000000 ] 256MB
[ 1.166274] aspeed-smc 1e620000.spi: CE1 window [ 0x30000000 - 0x30000000 ] 0MB (disabled)
[ 1.175514] aspeed-smc 1e620000.spi: read control register: [406c0641]
[ 1.231003] 2 fixed-partitions partitions found on MTD device bmc
[ 1.237840] Creating 2 MTD partitions on "bmc":
[ 1.242900] 0x000000000000-0x0000000f0000 : "u-boot"
[ 1.249735] 0x0000000f0000-0x000000100000 : "u-boot-env"
[ 1.258061] fmc_spi 1e631000.spi: controller is unqueued, this is deprecated
[ 1.265961] fmc_spi_setup() cs: 0, spi->mode 0 spi->max_speed_hz 10000000 , spi->bits_per_word 8
[ 1.275894] spi_ctrl 1000600
[ 1.279315] fmc_spi 1e631000.spi: fmc_spi : driver loaded
[ 1.285718] Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
[ 1.295321] libphy: mdio-aspeed: probed
[ 1.317527] libphy: mdio-aspeed: probed
[ 1.337571] libphy: Fixed MDIO Bus: probed
[ 1.342821] CAN device driver interface
[ 1.347342] fmc_spi_setup() cs: 0, spi->mode 0 spi->max_speed_hz 10000000 , spi->bits_per_word 8
[ 1.357277] spi_ctrl 1000600
[ 1.366718] random: fast init done
[ 1.376060] mcp251x spi0.0 can0: MCP2515 successfully initialized.
[ 1.383412] ftgmac100 1e660000.ftgmac: Read MAC address 12:2c:e3:e4:22:c7 from chip
[ 1.706721] Micrel KSZ9031 Gigabit PHY 1e650000.mdio-1:01: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=1e650000.mdio-1:01, irq=POLL)
[ 1.722810] ftgmac100 1e660000.ftgmac eth0: irq 40, mapped at (ptrval)
[ 1.730423] ftgmac100 1e680000.ftgmac: Read MAC address fa:38:94:5e:b7:43 from chip
[ 1.966759] random: crng init done
[ 2.056721] Micrel KSZ9031 Gigabit PHY 1e650008.mdio-1:02: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=1e650008.mdio-1:02, irq=POLL)
[ 2.072798] ftgmac100 1e680000.ftgmac eth1: irq 41, mapped at 5781ec99
[ 2.080378] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 2.087688] ehci-pci: EHCI PCI platform driver
[ 2.092720] ehci-platform: EHCI generic platform driver
[ 2.098831] uhci_hcd: USB Universal Host Controller Interface driver
[ 2.106844] usbcore: registered new interface driver usb-storage
[ 2.114566] aspeed-rtc 1e781000.rtc: registered as rtc0
[ 2.120701] i2c /dev entries driver
[ 2.125785] I2C: i2c-bus [0]: adapter [100 khz]
[ 2.131948] I2C: i2c-bus [1]: adapter [100 khz]
[ 2.138084] I2C: i2c-bus [2]: adapter [100 khz]
[ 2.144187] I2C: i2c-bus [3]: adapter [100 khz]
[ 2.150371] I2C: i2c-bus [4]: adapter [100 khz]
[ 2.156494] I2C: i2c-bus [5]: adapter [100 khz]
[ 2.162623] I2C: i2c-bus [6]: adapter [100 khz]
[ 2.168811] I2C: i2c-bus [7]: adapter [100 khz]
[ 2.175180] dt: /memory node resources: first page r.start=0x80000000, resource_size=0x40000000, PAGE_SHIFT macro=0xc
[ 2.187201] EDAC MC0: Giving out device to module aspeed-edac controller MIC: DEV 1e6e0000.sdram (INTERRUPT)
[ 2.199022] sdhci: Secure Digital Host Controller Interface driver
[ 2.205926] sdhci: Copyright(c) Pierre Ossman
[ 2.210801] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.218349] sdhci-aspeed 1e740100.sdhci: Configuring for slot 0
[ 2.225083] devm_gpio_request pwr fail
[ 2.229396] devm_gpio_request pwr sw fail
[ 2.286744] mmc1: SDHCI controller on 1e740100.sdhci [1e740100.sdhci] using PIO
[ 2.295792] sdhci-aspeed 1e750100.sdhci: Configuring for slot 0
[ 2.356732] mmc0: SDHCI controller on 1e750100.sdhci [1e750100.sdhci] using ADMA
[ 2.383950] ASPEED Crypto Accelerator successfully registered
[ 2.401745] ASPEED RSA Accelerator successfully registered
[ 2.408446] usbcore: registered new interface driver usbhid
[ 2.414669] usbhid: USB HID core driver
[ 2.426826] aspeed_adc: trim 8
[ 2.431344] aspeed_adc: cv 6
[ 2.435474] aspeed_adc: trim 8
[ 2.440023] aspeed_adc: cv 8
[ 2.444788] peci-aspeed 1e78b000.peci-bus: peci bus 0 registered, irq 63
[ 2.453654] NET: Registered protocol family 10
[ 2.459779] Segment Routing with IPv6
[ 2.464342] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 2.471701] NET: Registered protocol family 17
[ 2.476681] can: controller area network core (rev 20170425 abi 9)
[ 2.483668] NET: Registered protocol family 29
[ 2.488654] can: raw protocol (rev 20170425)
[ 2.493416] can: broadcast manager protocol (rev 20170425 t)
[ 2.499747] can: netlink gateway (rev 20170425) max_hops=1
[ 2.505935] 8021q: 802.1Q VLAN Support v1.8
[ 2.510714] Registering SWP/SWPB emulation handler
[ 2.523358] liteon-pmc pmc: added a shelf FRU device
[ 2.583924] mmc0: Tuning failed, falling back to fixed sampling clock
[ 2.591583] mmc0: new HS200 MMC card at address 0001
[ 2.597851] mmcblk0: mmc0:0001 4FPD3R 3.64 GiB
[ 2.603214] mmcblk0boot0: mmc0:0001 4FPD3R partition 1 4.00 MiB
[ 2.610176] mmcblk0boot1: mmc0:0001 4FPD3R partition 2 4.00 MiB
[ 2.617078] mmcblk0rpmb: mmc0:0001 4FPD3R partition 3 512 KiB, chardev (246:0)
[ 2.626207] mmcblk0: p1 p2 p3
[ 2.776758] liteon-pmc pmc: Driver initialized
[ 2.782163] printk: console [netcon0] enabled
[ 2.787065] netconsole: network logging started
[ 2.792396] aspeed-rtc 1e781000.rtc: hctosys: unable to read the hardware clock
[ 2.801284] RAMDISK: gzip image found at block 0
[ 2.921922] uncompression error
[ 2.972435] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
[ 2.980416] VFS: Mounted root (ext4 filesystem) on device 1:0.
[ 2.987294] EXT4-fs error (device ram0): ext4_lookup:1576: inode #2: comm swapper/0: deleted inode referenced: 64974
[ 2.999086] EXT4-fs (ram0): Remounting filesystem read-only
[ 3.005312] devtmpfs: error mounting -117
[ 3.012546] Freeing unused kernel memory: 1024K
[ 3.047716] Checked W+X mappings: passed, no W+X pages found
[ 3.054041] Run /sbin/init as init process
[ 3.058946] EXT4-fs error (device ram0): ext4_lookup:1576: inode #2: comm swapper/0: deleted inode referenced: 145588
[ 3.070854] Starting init: /sbin/init exists but couldn't execute it (error -117)
[ 3.079216] Run /etc/init as init process
[ 3.083933] EXT4-fs error (device ram0): ext4_lookup:1576: inode #2: comm swapper/0: deleted inode referenced: 16411
[ 3.095740] Starting init: /etc/init exists but couldn't execute it (error -117)
[ 3.104009] Run /bin/init as init process
[ 3.108741] EXT4-fs error (device ram0): ext4_lookup:1576: inode #2: comm swapper/0: deleted inode referenced: 81107
[ 3.120551] Starting init: /bin/init exists but couldn't execute it (error -117)
[ 3.128827] Run /bin/sh as init process
[ 3.133153] EXT4-fs error (device ram0): ext4_lookup:1576: inode #2: comm swapper/0: deleted inode referenced: 81107
[ 3.144969] Starting init: /bin/sh exists but couldn't execute it (error -117)
[ 3.153044] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[ 3.168864] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.1.3 #20
[ 3.175465] Hardware name: Generic DT based system
[ 3.180806] Backtrace:
[ 3.183544] [<8010e5fc>] (dump_backtrace) from [<8010e880>] (show_stack+0x20/0x24)
[ 3.191993] r7:809fa93c r6:60000093 r5:00000000 r4:80c6c0a4
[ 3.198311] [<8010e860>] (show_stack) from [<808af8ac>] (dump_stack+0x8c/0xa0)
[ 3.206373] [<808af820>] (dump_stack) from [<80121b78>] (panic+0x124/0x2f0)
[ 3.214139] r7:809fa93c r6:80c11e84 r5:00000000 r4:80c80648
[ 3.220456] [<80121a58>] (panic) from [<808c74b0>] (kernel_init+0x11c/0x124)
[ 3.228320] r3:80c09c48 r2:00000000 r1:3dc34000 r0:809fa93c
[ 3.234628] r7:00000000
[ 3.237452] [<808c7394>] (kernel_init) from [<801010e8>] (ret_from_fork+0x14/0x2c)
[ 3.245896] Exception stack(0xbe0e5fb0 to 0xbe0e5ff8)
[ 3.251530] 5fa0: 00000000 00000000 00000000 00000000
[ 3.260654] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 3.269778] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 3.277154] r5:808c7394 r4:00000000
[ 3.281145] CPU0: stopping
[ 3.284164] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.1.3 #20
[ 3.290764] Hardware name: Generic DT based system
[ 3.296103] Backtrace:
[ 3.298832] [<8010e5fc>] (dump_backtrace) from [<8010e880>] (show_stack+0x20/0x24)
[ 3.307278] r7:00000000 r6:60000193 r5:00000000 r4:80c6c0a4
[ 3.313593] [<8010e860>] (show_stack) from [<808af8ac>] (dump_stack+0x8c/0xa0)
[ 3.321653] [<808af820>] (dump_stack) from [<80111668>] (handle_IPI+0x340/0x374)
[ 3.329904] r7:00000000 r6:00000000 r5:00000004 r4:80c80508
[ 3.336219] [<80111328>] (handle_IPI) from [<80102230>] (gic_handle_irq+0x84/0x88)
[ 3.344667] r10:80b5da40 r9:80c00000 r8:80c01ed8 r7:c0803000 r6:c0802000 r5:c080200c
[ 3.353401] r4:80c0a304 r3:80109afc
[ 3.357388] [<801021ac>] (gic_handle_irq) from [<80101a6c>] (__irq_svc+0x6c/0x90)
[ 3.365733] Exception stack(0x80c01ed8 to 0x80c01f20)
[ 3.371365] 1ec0: 00000000 000015f0
[ 3.380491] 1ee0: be7b18a0 8011c500 80c00000 00000000 80c09c70 80c09cac 80c71405 80a020d0
[ 3.389616] 1f00: 80b5da40 80c01f34 80c01f38 80c01f28 80109afc 80109b00 60000013 ffffffff
[ 3.398741] r9:80c00000 r8:80c71405 r7:80c01f0c r6:ffffffff r5:60000013 r4:80109b00
[ 3.407385] [<80109ab8>] (arch_cpu_idle) from [<808ceef4>] (default_idle_call+0x30/0x3c)
[ 3.416415] [<808ceec4>] (default_idle_call) from [<80154524>] (do_idle+0xe8/0x168)
[ 3.424960] [<8015443c>] (do_idle) from [<80154870>] (cpu_startup_entry+0x28/0x2c)
[ 3.433407] r9:80c80280 r8:80c09c40 r7:80c80280 r6:ffffffff r5:00000001 r4:000000c9
[ 3.442049] [<80154848>] (cpu_startup_entry) from [<808c738c>] (rest_init+0xb8/0xc0)
[ 3.450691] [<808c72d4>] (rest_init) from [<80b00b94>] (arch_call_rest_init+0x18/0x1c)
[ 3.459521] r5:00000001 r4:80c802d8
[ 3.463509] [<80b00b7c>] (arch_call_rest_init) from [<80b0109c>] (start_kernel+0x4a4/0x4e0)
[ 3.472827] [<80b00bf8>] (start_kernel) from [<00000000>] ( (null))
[ 3.479923] WDT reset called
BP
Root cause of issue:
It looks like ASPEED modified the low level memmove function in /lib/string.c to speed up flash copies. In their code, count is changed to a 4 byte boundary which breaks the back to front copy from memmove_wd.
#ifdef CONFIG_ASPEED_SPI_DMA
if (dest == src)
return dest;
if (
((u32)src >= ASPEED_FMC_CS0_BASE)
&& ((u32)src < (ASPEED_FMC_CS0_BASE + 0x10000000))) {
count = ((count + 3) / 4) * 4;
aspeed_spi_fastcpy((u32)dest, (u32)src, count);
return dest;
}
#endif
I switched memmove_wd() in u-boot/common/image.c to a simpler front to back copy and added the check for CONFIG_WDT and everything works now.
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) || defined(CONFIG_WDT)
{
while (len > 0)
{
size_t chunk = (len > chunksz) ? chunksz : len;
WATCHDOG_RESET();
memmove(to, from, chunk);
to += chunk;
from += chunk;
len -= chunk;
}
Another option would be to disable CONFIG_ASPEED_SPI_DMA.

meteor Verifying Deployment - Connection refused

I am trying to deploy a meteor Application, But I am receiving this error message on the Verifying Deployment section with the following error message -
------------------------------------STDERR------------------------------------
: (7) Failed to connect to 172.17.0.2 port 3000: Connection refused
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (7) Failed to connect to 172.17.0.2 port 3000: Connection refused
=> Logs:
=> Setting node version
NODE_VERSION=14.17.4
v14.17.4 is already installed.
Now using node v14.17.4 (npm v6.14.14)
default -> 14.17.4 (-> v14.17.4 *)
=> Starting meteor app on port 3000
=> Redeploying previous version of the app
When I do the sudo netstat -tulpn | grep LISTEN in the server it shows this
tcp 0 0 10.0.3.1:53 0.0.0.0:* LISTEN 609/dnsmasq
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 406/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 745/sshd: /usr/sbin
tcp6 0 0 :::22 :::* LISTEN 745/sshd: /usr/sbin
When I run sudo docker ps i receive the following message -
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e51b1b4bf3a3 mup-appName:latest "/bin/sh -c 'exec $M…" About an hour ago Restarting (1) 49 seconds ago appName
68b723183f3d mongo:3.4.1 "/entrypoint.sh mong…" 9 days ago Restarting (100) 9 seconds ago mongodb
In my firewall i have also opened the Port 3000
If I check the Docker is running it seems like there is no docker running!!
Also in my mup.js file I am using http and not https
module.exports = {
servers: {
one: {
host: 'xx.xx.xxx.xxx',
username: 'ubuntu',
pem: '/home/runner/.ssh/id_rsa'
}
},
meteor: {
name: 'appName',
path: '../../',
docker: {
image: 'zodern/meteor:latest',
},
servers: {
one: {}
},
buildOptions: {
serverOnly: true
},
env: {
PORT: 3000,
ROOT_URL: 'http://dev-api.appName.com/',
NODE_ENV: 'production',
MAIL_URL: 'smtp://xxxx:xxx/eLPCB3nw3jubkq:#email-smtp.eu-north-1.amazonaws.com:587',
MONGO_URL: 'mongodb+srv://xxx:xx#xxx.iiitd.mongodb.net/Development?retryWrites=true&w=majority'
},
deployCheckWaitTime: 15
}
proxy: {
domains: 'dev.xxx.com',
ssl: {
letsEncryptEmail: 'info#xxx.com'
}
}
}
Any idea what might cause this issue?
I don't know why, but in the MUP docs the correct image name is zodern/meteor:root
If your app is slow to start, increase the deployCheckWaitTime . In my complex apps I put 600, just to ensure the app is up.

Docker on Ubuntu unable to connect to localhost but works connecting to its ip

I am running Ubuntu 18.04
$ uname -r
5.3.0-46-generic
I have docker installed
$ docker --version
Docker version 19.03.8, build afacb8b7f0
I have a simple docker image that exposes port 80. The Dockerfile that generated it was
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
COPY publish .
EXPOSE 80
ENTRYPOINT ["dotnet", "SampleWebApp.dll"]
When I run a container for this image I can see the following:
$ docker run myimage:latest -p 8080:80
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /
And if I see the containers running:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6f5bea7b329d registry.gitlab.com/whatever/myimage:latest "dotnet SampleWebApp…" 4 seconds ago Up 2 seconds 80/tcp dreamy_leavitt
So I can see that it's running on the port 80/tcp.
Not sure why it does not run on port 8080 which is where I wanted to map it.
Also, the http://[::]:80 seems confusing. I've read something about it being IPv6. No idea what consequences this has or why normal IPv4 wouldn't work.
My interface info:
$ ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:71ff:fe7f:305 prefixlen 64 scopeid 0x20<link>
ether 02:42:71:7f:03:05 txqueuelen 0 (Ethernet)
RX packets 131843 bytes 105630866 (105.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 201439 bytes 268197990 (268.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp3s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 1c:1b:0d:a4:83:16 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 118628 bytes 17999594 (17.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 118628 bytes 17999594 (17.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethca5fd09: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::3c56:d6ff:fe0c:846 prefixlen 64 scopeid 0x20<link>
ether 3e:56:d6:0c:08:46 txqueuelen 0 (Ethernet)
RX packets 7 bytes 533 (533.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 52 bytes 7342 (7.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp6s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.135 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::8a58:c682:3833:3bb1 prefixlen 64 scopeid 0x20<link>
ether e4:be:ed:4f:0f:21 txqueuelen 1000 (Ethernet)
RX packets 519710 bytes 524989683 (524.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 439859 bytes 165781721 (165.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
So.. docker interface seems to have the address 172.17.0.1.
However I cannot access my container using the following urls:
$ curl http://localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused
$ curl http://localhost:80
curl: (7) Failed to connect to localhost port 80: Connection refused
$ curl http://0.0.0.0:80
curl: (7) Failed to connect to 0.0.0.0 port 80: Connection refused
$ curl http://0.0.0.0:8080
curl: (7) Failed to connect to 0.0.0.0 port 8080: Connection refused
$ curl http://172.17.0.1:8080
curl: (7) Failed to connect to 172.17.0.1 port 8080: Connection refused
$ curl http://172.17.0.1:80
curl: (7) Failed to connect to 172.17.0.1 port 80: Connection refused
$ curl http://127.0.0.1:8080
curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused
$ curl http://127.0.0.1:80
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
so no access using localhost, 127.0.0.1 or the docker interface IP.
If I inspect the container:
sasw#Z3:~$ docker inspect 6f5bea7b329d
[
{
"Id": "6f5bea7b329d05bcb534953745f376da9c7efbe54de5532f8648b618152b722a",
"Created": "2020-04-20T13:06:37.883347676Z",
"Path": "dotnet",
"Args": [
"SampleWebApp.dll",
"-p",
"8080:80"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 30636,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-04-20T13:06:38.295411125Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:e00403d6c5eb3ccbe3c5c7b6ec8cf8289158e4c9fbe6ff5872ea932e69d60f38",
"ResolvConfPath": "/var/lib/docker/containers/6f5bea7b329d05bcb534953745f376da9c7efbe54de5532f8648b618152b722a/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/6f5bea7b329d05bcb534953745f376da9c7efbe54de5532f8648b618152b722a/hostname",
"HostsPath": "/var/lib/docker/containers/6f5bea7b329d05bcb534953745f376da9c7efbe54de5532f8648b618152b722a/hosts",
"LogPath": "/var/lib/docker/containers/6f5bea7b329d05bcb534953745f376da9c7efbe54de5532f8648b618152b722a/6f5bea7b329d05bcb534953745f376da9c7efbe54de5532f8648b618152b722a-json.log",
"Name": "/dreamy_leavitt",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/8f56c544522ccb6556358601706cb900c405c19b47e54c25d8b3dac979100e5b-init/diff:/var/lib/docker/overlay2/81bfee49e33d9761a6ca78dfd6f3f9a54a9333b4d4fc9986e8084f6b45232f04/diff:/var/lib/docker/overlay2/c2add2cb2d687126c6826c7dd9e1c85be1473a53d6b878554aa87615701344a0/diff:/var/lib/docker/overlay2/ebd0b92c5111423fb8d1219f757e41013a1473bdbe5cf3553cecbd4337f76766/diff:/var/lib/docker/overlay2/9197af6ebe4c70f0a84c7c267b1ba069aa710d917abe9fb3fee13320a17ab765/diff:/var/lib/docker/overlay2/1f463e8667b6eecc7c251ac05316b8d5d32840bff13d9f5cb7853c88e6f1f40e/diff:/var/lib/docker/overlay2/b7c9450f53334bef02f50cc854b33140b97f4ff3d2343b3fcac7b20f647c454e/diff",
"MergedDir": "/var/lib/docker/overlay2/8f56c544522ccb6556358601706cb900c405c19b47e54c25d8b3dac979100e5b/merged",
"UpperDir": "/var/lib/docker/overlay2/8f56c544522ccb6556358601706cb900c405c19b47e54c25d8b3dac979100e5b/diff",
"WorkDir": "/var/lib/docker/overlay2/8f56c544522ccb6556358601706cb900c405c19b47e54c25d8b3dac979100e5b/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "6f5bea7b329d",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"ASPNETCORE_URLS=http://+:80",
"DOTNET_RUNNING_IN_CONTAINER=true"
],
"Cmd": [
"-p",
"8080:80"
],
"Image": "registry.gitlab.com/ddd-malaga/continuous-deployment-gitlab-docker-dotnet:latest",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"dotnet",
"SampleWebApp.dll"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "4e53bd2bc6cb83b7c0cba9fcdf07eb564a11ca6b955514670ba3f464aa0a96b7",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"80/tcp": null
},
"SandboxKey": "/var/run/docker/netns/4e53bd2bc6cb",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "83976112bb202b79880777563cd1b06ef27781fd288b210b19fb499e3bf51c90",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "7589efd57cea8d2b04823657fcfc54225991bc58c93ff0e463b6f12acb28b853",
"EndpointID": "83976112bb202b79880777563cd1b06ef27781fd288b210b19fb499e3bf51c90",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]
I can see the IP Address 172.17.0.2. Again, I don't know where this comes from.
But now I can try to access the container IP at the port I told it to map:
$ curl http://172.17.0.2:8080
curl: (7) Failed to connect to 172.17.0.2 port 8080: Connection refused
Surprisingly, if I access the same container IP but the exposed port 80 it works
sasw#Z3:/$ curl http://172.17.0.2:80
Hello World!
If I stop and delete complete container and images and try again with the following random port:
$ docker run myimage:latest -p 1234:1234
Status: Downloaded newer image for registry.gitlab.com/myimage:latest
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /
it seems those ports are completely ignored and it remains listening on the container ip and port 80
$ curl http://172.17.0.2:80
Hello World!
It's clear I am missing some knowledge here and the links I find are not very useful or the point me to things about IPv6 like this https://docs.docker.com/config/daemon/ipv6/ that mentions something about a /etc/docker/daemon.json which I don't even have.
Could anybody point me into the right direction to understand what's happening and why? Thanks!
It seems the problem was that none of my arguments to docker run was taking effect because I placed them AFTER the image. Insane!
So this:
docker run myimage:latest -p 8080:80 --name whatever
will run the container ignoring completely the port mapping and the container assigned name.
However this:
docker run -p 8080:80 --name whatever myimage:latest
Will map the port 80 to my localhost:8080 so that the web app is available at https://localhost:8080

How to insert lines after second pattern with linux sed command

I want to insert this block:
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
after this block:
subnet 11.10.0.0 netmask 255.255.255.0 {
range 11.10.1.2 11.10.1.254;
group {
filename "10M-5M-OKS2016NOV.cm";
The line: filename "10M-5M-OKS2016NOV.cm";
apears multiple times in the file. But only once inside subnet 11.10.0.0 netmask 255.255.255.0 {
Until now I can print the subnet block until the "filename":
sed -n -e :a -e '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/,/}/{/filename "10M-5M-OKS2016NOV\.cm";/!{$!{N;ba};};p;}' dhcpd.conf
but when I try:
sed -n -e :a -e '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/,/}/{/filename "10M-5M-OKS2016NOV\.cm";/!{$!{N;ba};};a\ \thost client3 {\n\thardware ethernet c0:03:03:bc:30:fa;\n\t}\n;}' dhcpd.conf
I get:
sed: -e expression #1, char 0: unmatched `{'
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet a0:b4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ba:cd:d4;
}
}
}
subnet 11.10.0.0 netmask 255.255.255.0 {
range 11.10.1.2 11.10.1.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet c0:14:e3:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:fb:ba:3d:04;
}
}
}
subnet 12.10.0.0 netmask 255.255.255.0 {
range 12.10.2.2 12.10.2.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet c0:a4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ca:3d:04;
}
}
}
Please try something like:
#!/bin/bash
# define newline and tab characters for replacement
NL=$'\n'
NL="\\$NL"
TAB=$'\t'
TAB="\\$TAB"
sed '
:l
N
$!b l
# first of all slurp all lines in the pattern space
# and perform the replacement over the lines
s/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0[^}]*filename "10M-5M-OKS2016NOV\.cm";/&'"$NL$TAB"'host client3 {'"$NL$TAB$TAB"'hardware ethernet c0:03:03:bc:30:fa;'"$NL$TAB"'}/g
' dhcpd.conf
It yields the following output by using the posted lines as dhcpd.conf,
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet a0:b4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ba:cd:d4;
}
}
}
subnet 11.10.0.0 netmask 255.255.255.0 {
range 11.10.1.2 11.10.1.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
host client1 {
hardware ethernet c0:14:e3:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:fb:ba:3d:04;
}
}
}
subnet 12.10.0.0 netmask 255.255.255.0 {
range 12.10.2.2 12.10.2.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet c0:a4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ca:3d:04;
}
}
}
It initially slurps all the lines at first to process multi lines efficiently.
It assumes the right curly brace } does not appear in the search target block
to achieve the shortest match in regex.
Hope this helps.
This might work for you (GNU sed):
sed '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/{:a;n;/filename "10M-5M-OKS2016NOV\.cm";/!ba;p;s/\S.*/host client3 {/p;s// hardware ethernet c0:03:03:bc:30:fa;/p;s//}/}' file
This finds the first line containing subnet 11.10.0.0 netmask 255.255.255.0 and then reads on further until the line containing filename "10M-5M-OKS2016NOV.cm";. After printing that line it uses the line as a template to format the required detail.
Another solution, using a preformed insertion file:
cat <<\! | sed '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/!b;:a;n;/filename "10M-5M-OKS2016NOV\.cm";/!ba;r /dev/stdin' file
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
!
sed is great as a stream editor, that means to process multiple times the same actions. Here you just want to insert once a bloc of text. That would be much simpler (more readable and maintenable) with ed:
ed dhcpd.conf <<EOF
/subnet 11.10.0.0/
/filename/
a
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
.
w
q
EOF
Beware: ed is a file editor. That means that the dhcpd.conf file will be changed by the above script. Make sure to have a backup if things goes wrong...

Linux kernel cannot receive multicast

I built a Linux kernel with CONFIG_IP_MULTICAST=y,however no UDP multicast package received in this kernel while UDP unicast works well.
ethtool -S eth0 | grep multicast
txmulticastframes_g: 0
txmulticastframes_gb: 0
rxmulticastframes_g: 0
Any hints how can I solve this problem?
Thx. Forrest G
=================================================================================
Additional:
tcpdump can get the packet
root#JHI # ./tcpdump port 3702
device eth0 entered promiscuous mode
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
-7:-48:-19.4151 IP 192.168.42.212.3702 > 239.255.255.250.3702: UDP, length 787
-7:-48:-19.4661 IP 192.168.42.212.3702 > 239.255.255.250.3702: UDP, length 803
^C
2 packets captured
2 padevice eth0 left promiscuous mode
ckets received by filter
0 packets dropped by kernel
I write this WS-devicediscovery function with gSOAP. It works on X86 machine. When running on ARM device, it can send out igmp packet but not receive anything.
void wsdd()
{
struct soap *soap_udp;
struct ip_mreq mreq;
soap_udp=soap_new();
soap_init1(soap_udp, SOAP_IO_UDP|SOAP_IO_FLUSH);
if (!soap_valid_socket(soap_bind(soap_udp, NULL, 3702, 100)))
{
soap_print_fault(soap_udp, stderr);
}
mreq.imr_multiaddr.s_addr = inet_addr("239.255.255.250");
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
if(setsockopt(soap_ud->master,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq))==-1) {
perror("membership error\n");
}
int loop = 1;
int sock_opt = 1;
if ((setsockopt(soap_udp->master, SOL_SOCKET, SO_REUSEADDR, (void *) &sock_opt,
sizeof (sock_opt))) == -1) {
printf("setsockopt\n");
}
if ((setsockopt(soap_udp->master, IPPROTO_IP, IP_MULTICAST_LOOP,
&loop, sizeof (loop))) == -1) {
printf("setsockopt\n");
}
while(1){
soap_accept(soap_udp);
soap_serve(soap_udp);
soap_end(soap_udp);
}
}
Then I have tried these things but still not work
route add -net 224.0.0.0 netmask 240.0.0.0 eth0
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
Problem solved by changing..
ifconfig eth0 promisc
Can anyone explain the principle?

Resources